Sha256: 7513835162b7d893beee72fce3152b2fac8653ad0a33db13ccf06f8c0bd203fe

Contents?: true

Size: 739 Bytes

Versions: 38

Compression:

Stored size: 739 Bytes

Contents

module Serverspec::Type
  class HadoopConfig < Base
    def initialize(name=nil, options={})
      super

      begin
        require 'nokogiri'
      rescue LoadError
        fail "nokogiri is not available. Try installing it."
      end
    end

    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
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
serverspec-2.42.3 lib/serverspec/type/hadoop_config.rb
serverspec-2.42.2 lib/serverspec/type/hadoop_config.rb
serverspec-2.42.1 lib/serverspec/type/hadoop_config.rb
serverspec-cem-acpt-2.42.0 lib/serverspec/type/hadoop_config.rb
serverspec-2.42.0 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.8 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.7 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.6 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.5 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.4 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.3 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.2 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.1 lib/serverspec/type/hadoop_config.rb
serverspec-2.41.0 lib/serverspec/type/hadoop_config.rb
serverspec-2.40.0 lib/serverspec/type/hadoop_config.rb
serverspec-2.39.2 lib/serverspec/type/hadoop_config.rb
serverspec-2.39.1 lib/serverspec/type/hadoop_config.rb
serverspec-2.39.0 lib/serverspec/type/hadoop_config.rb
serverspec-2.38.1 lib/serverspec/type/hadoop_config.rb
serverspec-2.38.0 lib/serverspec/type/hadoop_config.rb