class Serverspec::Type::HadoopConfig
Public Class Methods
new(name=nil, options={})
click to toggle source
Calls superclass method
Serverspec::Type::Base::new
# File lib/serverspec/type/hadoop_config.rb, line 3 def initialize(name=nil, options={}) super begin require 'nokogiri' rescue LoadError fail "nokogiri is not available. Try installing it." end end
Public Instance Methods
value()
click to toggle source
# File lib/serverspec/type/hadoop_config.rb, line 13 def value @runner.run_command("find /etc/hadoop/conf/ -type f -name \"*.xml\" ").stdout.split(/\n/).each do |file| @doc = ::Nokogiri::XML( @runner.get_file_content("#{file}").stdout.strip ) @doc.xpath('/configuration/property').each do |property| case property.xpath('name').text when /#{@name}/ ret = property.xpath('value').text val = ret.to_s return val end end end end