summaryrefslogtreecommitdiff
path: root/lib/chef/resource/hostname.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/hostname.rb')
-rw-r--r--lib/chef/resource/hostname.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/resource/hostname.rb b/lib/chef/resource/hostname.rb
index 9030c48f87..16986c09a3 100644
--- a/lib/chef/resource/hostname.rb
+++ b/lib/chef/resource/hostname.rb
@@ -53,12 +53,13 @@ class Chef
# @return [String]
def updated_ec2_config_xml
begin
- require "nokogiri"
+ require "rexml/document"
config_file = 'C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml'
- config = ::Nokogiri::XML(::File.read(config_file))
+ config = REXML::Document.new(::File.read(config_file))
# find an element named State with a sibling element whose value is Ec2SetComputerName
- setting = config.at_xpath("//Plugin/State[../Name/text() = 'Ec2SetComputerName']")
- setting.content = "Disabled"
+ REXML::XPath.each(config, "//Plugin/State[../Name/text() = 'Ec2SetComputerName']") do |element|
+ element.text = "Disabled"
+ end
rescue
return ""
end