ohai 8.13.0 → 8.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/lib/ohai/common/dmi.rb +1 -1
  4. data/lib/ohai/config.rb +2 -2
  5. data/lib/ohai/dsl/plugin.rb +1 -1
  6. data/lib/ohai/loader.rb +1 -1
  7. data/lib/ohai/mixin/command.rb +18 -5
  8. data/lib/ohai/mixin/ec2_metadata.rb +1 -1
  9. data/lib/ohai/plugins/aix/os.rb +1 -1
  10. data/lib/ohai/plugins/c.rb +49 -67
  11. data/lib/ohai/plugins/darwin/memory.rb +1 -1
  12. data/lib/ohai/plugins/darwin/network.rb +3 -3
  13. data/lib/ohai/plugins/darwin/platform.rb +1 -1
  14. data/lib/ohai/plugins/darwin/system_profiler.rb +1 -1
  15. data/lib/ohai/plugins/digital_ocean.rb +1 -1
  16. data/lib/ohai/plugins/ec2.rb +42 -41
  17. data/lib/ohai/plugins/erlang.rb +1 -1
  18. data/lib/ohai/plugins/ip_scopes.rb +1 -1
  19. data/lib/ohai/plugins/kernel.rb +1 -1
  20. data/lib/ohai/plugins/linux/network.rb +2 -2
  21. data/lib/ohai/plugins/linux/platform.rb +6 -1
  22. data/lib/ohai/plugins/mono.rb +1 -1
  23. data/lib/ohai/plugins/network.rb +2 -2
  24. data/lib/ohai/plugins/packages.rb +59 -46
  25. data/lib/ohai/plugins/python.rb +2 -2
  26. data/lib/ohai/plugins/rackspace.rb +4 -4
  27. data/lib/ohai/plugins/sigar/network.rb +1 -1
  28. data/lib/ohai/plugins/sigar/network_route.rb +1 -1
  29. data/lib/ohai/plugins/solaris2/dmi.rb +1 -1
  30. data/lib/ohai/plugins/solaris2/network.rb +25 -8
  31. data/lib/ohai/plugins/ssh_host_key.rb +1 -1
  32. data/lib/ohai/plugins/windows/network.rb +5 -5
  33. data/lib/ohai/provides_map.rb +2 -2
  34. data/lib/ohai/system.rb +1 -1
  35. data/lib/ohai/version.rb +1 -1
  36. data/spec/functional/loader_spec.rb +1 -1
  37. data/spec/unit/mixin/command_spec.rb +118 -0
  38. data/spec/unit/plugins/aix/os_spec.rb +6 -5
  39. data/spec/unit/plugins/c_spec.rb +169 -118
  40. data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
  41. data/spec/unit/plugins/dmi_spec.rb +4 -4
  42. data/spec/unit/plugins/ec2_spec.rb +64 -69
  43. data/spec/unit/plugins/linode_spec.rb +6 -6
  44. data/spec/unit/plugins/linux/platform_spec.rb +7 -0
  45. data/spec/unit/plugins/linux/sessions_spec.rb +2 -2
  46. data/spec/unit/plugins/network_spec.rb +16 -16
  47. data/spec/unit/plugins/openstack_spec.rb +1 -1
  48. data/spec/unit/plugins/packages_spec.rb +165 -191
  49. data/spec/unit/plugins/rackspace_spec.rb +203 -130
  50. data/spec/unit/plugins/solaris2/filesystem.rb +2 -2
  51. data/spec/unit/plugins/solaris2/network_spec.rb +36 -5
  52. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 653220934f733f38ccf77e2995b60dafff3a8cb4
4
- data.tar.gz: d853852c8a1bb4912970a3562e60c9a91636a5de
3
+ metadata.gz: 880a68c3c0a321e516f4ebd6fe4d8ea96dc4bd81
4
+ data.tar.gz: e6f7e6019d46c47e58cc642ba8104624bd5cfdd3
5
5
  SHA512:
6
- metadata.gz: e03fdd75bfde725021994265b3ba2ed5474c9d37f5409886e4cc29656616bb7647e199db6efbea708e446391ca410692d69fcc95072ba3ca8a936dee6321b8e3
7
- data.tar.gz: 36ed710e0d3813f796dbf2fd3b970583610e4731c8ed53e203de69cf1abc170aed18942ed999d571fd4547cac87f94e0d7c3071e5604020b49fa5ec6e938cafa
6
+ metadata.gz: 79c39d1fc907eda3130f429f3ca5f0b7511e5448e83188ef6d59148b36d8e661bcc550a8e61eb194259c32fe42e015e5ef49236cde4636af68f1ad6d744326c1
7
+ data.tar.gz: 967a82e37972b3d947c81612d983e52124479c419d4a1161a9bf8e825d61b40fbeea720ff9658981daa2a228d87d04eec2048dc44ec64752c4b763dba795abd1
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
  group :development do
6
6
  gem "sigar", :platform => "ruby"
7
7
 
8
- gem "chefstyle", "= 0.3.0"
8
+ gem "chefstyle", "= 0.3.1"
9
9
  # gem 'pry-byebug'
10
10
  # gem 'pry-stack_explorer'
11
11
  end
@@ -77,7 +77,7 @@ module Ohai
77
77
  def id_lookup(id)
78
78
  begin
79
79
  id = id.to_i
80
- if (id >= 128) and (id <= 255)
80
+ if (id >= 128) && (id <= 255)
81
81
  id = "oem_data_#{id}"
82
82
  elsif DMI::IdToDescription.has_key?(id)
83
83
  id = DMI::IdToDescription[id]
data/lib/ohai/config.rb CHANGED
@@ -105,7 +105,7 @@ module Ohai
105
105
  private
106
106
 
107
107
  def self.option_deprecated(option)
108
- <<-EOM.chomp!.gsub("\n", " ")
108
+ <<-EOM.chomp!.tr("\n", " ")
109
109
  Ohai::Config[:#{option}] is set. Ohai::Config[:#{option}] is deprecated and will
110
110
  be removed in future releases of ohai. Use ohai.#{option} in your configuration
111
111
  file to configure :#{option} for ohai.
@@ -113,7 +113,7 @@ EOM
113
113
  end
114
114
 
115
115
  def self.option_might_be_deprecated(option)
116
- option_deprecated(option) + <<-EOM.chomp!.gsub("\n", " ")
116
+ option_deprecated(option) + <<-EOM.chomp!.tr("\n", " ")
117
117
  If your configuration file is used with other applications which configure
118
118
  :#{option}, and you have not configured Ohai::Config[:#{option}], you may
119
119
  disregard this warning.
@@ -117,7 +117,7 @@ module Ohai
117
117
 
118
118
  def each(&block)
119
119
  @data.each do |key, value|
120
- block.call(key, value)
120
+ yield(key, value)
121
121
  end
122
122
  end
123
123
 
data/lib/ohai/loader.rb CHANGED
@@ -173,7 +173,7 @@ For more information visit here: docs.chef.io/ohai_custom.html")
173
173
 
174
174
  def load_v7_plugin_class(contents, plugin_path)
175
175
  plugin_class = eval(contents, TOPLEVEL_BINDING, plugin_path)
176
- unless plugin_class.kind_of?(Class) and plugin_class < Ohai::DSL::Plugin
176
+ unless plugin_class.kind_of?(Class) && plugin_class < Ohai::DSL::Plugin
177
177
  raise Ohai::Exceptions::IllegalPluginDefinition, "Plugin file cannot contain any statements after the plugin definition"
178
178
  end
179
179
  plugin_class.sources << plugin_path
@@ -28,10 +28,23 @@ require "mixlib/shellout"
28
28
  module Ohai
29
29
  module Mixin
30
30
  module Command
31
- def shell_out(cmd)
32
- m = Mixlib::ShellOut.new(cmd)
33
- m.run_command
34
- m
31
+ # DISCLAIMER: Logging only works in the context of a plugin!!
32
+ # accept a command and any of the mixlib-shellout options
33
+ def shell_out(cmd, **options)
34
+ # unless specified by the caller timeout after 30 seconds
35
+ options[:timeout] ||= 30
36
+ so = Mixlib::ShellOut.new(cmd, options)
37
+ begin
38
+ so.run_command
39
+ Ohai::Log.debug("Plugin #{self.name} ran '#{cmd}' and returned #{so.exitstatus}")
40
+ so
41
+ rescue Errno::ENOENT => e
42
+ Ohai::Log.debug("Plugin #{self.name} ran '#{cmd}' and failed #{e.inspect}")
43
+ raise Ohai::Exceptions::Exec, e
44
+ rescue Mixlib::ShellOut::CommandTimeout => e
45
+ Ohai::Log.debug("Plugin #{self.name} ran '#{cmd}' and timed out after #{options[:timeout]} seconds")
46
+ raise Ohai::Exceptions::Exec, e
47
+ end
35
48
  end
36
49
 
37
50
  module_function :shell_out
@@ -70,7 +83,7 @@ module Ohai
70
83
 
71
84
  args[:returns] ||= 0
72
85
  args[:no_status_check] ||= false
73
- if status.exitstatus != args[:returns] and not args[:no_status_check]
86
+ if status.exitstatus != args[:returns] && (not args[:no_status_check])
74
87
  raise Ohai::Exceptions::Exec, "#{args[:command_string]} returned #{status.exitstatus}, expected #{args[:returns]}"
75
88
  else
76
89
  Ohai::Log.debug("Ran #{args[:command_string]} (#{args[:command]}) returned #{status.exitstatus}")
@@ -140,7 +140,7 @@ module Ohai
140
140
  else
141
141
  metadata_get(key, api_version)
142
142
  end
143
- elsif not key.eql?(id) and not key.eql?("/")
143
+ elsif (not key.eql?(id)) && (not key.eql?("/"))
144
144
  name = key[0..-2]
145
145
  sym = metadata_key(name)
146
146
  if EC2_ARRAY_DIR.include?(name)
@@ -25,6 +25,6 @@ Ohai.plugin(:OS) do
25
25
 
26
26
  collect_data(:aix) do
27
27
  os collect_os
28
- os_version kernel[:version]
28
+ os_version shell_out("oslevel -s").stdout.strip
29
29
  end
30
30
  end
@@ -23,74 +23,64 @@ Ohai.plugin(:C) do
23
23
 
24
24
  depends "languages"
25
25
 
26
+ def collect(cmd, &block)
27
+ so = shell_out(cmd)
28
+ yield(so) if so.exitstatus == 0
29
+ rescue Ohai::Exceptions::Exec
30
+ # ignore
31
+ end
32
+
26
33
  collect_data do
27
34
  c = Mash.new
28
35
 
29
36
  #gcc
30
- begin
31
- so = shell_out("gcc -v")
32
- if so.exitstatus == 0
33
- description = so.stderr.split($/).last
34
- output = description.split
35
- if output.length >= 3
36
- c[:gcc] = Mash.new
37
- c[:gcc][:version] = output[2]
38
- c[:gcc][:description] = description
39
- end
37
+ collect("gcc -v") do |so|
38
+ description = so.stderr.split($/).last
39
+ output = description.split
40
+ if output.length >= 3
41
+ c[:gcc] = Mash.new
42
+ c[:gcc][:version] = output[2]
43
+ c[:gcc][:description] = description
40
44
  end
41
- rescue Errno::ENOENT
42
45
  end
43
46
 
44
47
  #glibc
45
48
  ["/lib/libc.so.6", "/lib64/libc.so.6"].each do |glibc|
46
- begin
47
- so = shell_out( Ohai.abs_path( glibc ))
48
- if so.exitstatus == 0
49
- description = so.stdout.split($/).first
50
- if description =~ /(\d+\.\d+\.?\d*)/
51
- c[:glibc] = Mash.new
52
- c[:glibc][:version] = $1
53
- c[:glibc][:description] = description
54
- end
55
- break
49
+ collect( Ohai.abs_path( glibc )) do |so|
50
+ description = so.stdout.split($/).first
51
+ if description =~ /(\d+\.\d+\.?\d*)/
52
+ c[:glibc] = Mash.new
53
+ c[:glibc][:version] = $1
54
+ c[:glibc][:description] = description
56
55
  end
57
- rescue Errno::ENOENT
58
- end
56
+ end unless c[:glibc]
59
57
  end
60
58
 
61
59
  #ms cl
62
- begin
63
- so = shell_out("cl /?")
64
- if so.exitstatus == 0
65
- description = so.stderr.lines.first.chomp
66
- if description =~ /Compiler Version ([\d\.]+)/
67
- c[:cl] = Mash.new
68
- c[:cl][:version] = $1
69
- c[:cl][:description] = description
70
- end
60
+ collect("cl /?") do |so|
61
+ description = so.stderr.lines.first.chomp
62
+ if description =~ /Compiler Version ([\d\.]+)/
63
+ c[:cl] = Mash.new
64
+ c[:cl][:version] = $1
65
+ c[:cl][:description] = description
71
66
  end
72
- rescue Errno::ENOENT
73
67
  end
74
68
 
75
69
  #ms vs
76
- begin
77
- so = shell_out("devenv.com /?")
78
- if so.exitstatus == 0
79
- lines = so.stdout.split($/)
80
- description = lines[0].length == 0 ? lines[1] : lines[0]
81
- if description =~ /Visual Studio Version ([\d\.]+)/
82
- c[:vs] = Mash.new
83
- c[:vs][:version] = $1.chop
84
- c[:vs][:description] = description
85
- end
70
+ collect("devenv.com /?") do |so|
71
+ lines = so.stdout.split($/)
72
+ description = lines[0].length == 0 ? lines[1] : lines[0]
73
+ if description =~ /Visual Studio Version ([\d\.]+)/
74
+ c[:vs] = Mash.new
75
+ c[:vs][:version] = $1.chop
76
+ c[:vs][:description] = description
86
77
  end
87
- rescue Errno::ENOENT
88
78
  end
89
79
 
90
80
  #ibm xlc
91
81
  begin
92
82
  so = shell_out("xlc -qversion")
93
- if so.exitstatus == 0 or (so.exitstatus >> 8) == 249
83
+ if so.exitstatus == 0 || (so.exitstatus >> 8) == 249
94
84
  description = so.stdout.split($/).first
95
85
  if description =~ /V(\d+\.\d+)/
96
86
  c[:xlc] = Mash.new
@@ -98,36 +88,28 @@ Ohai.plugin(:C) do
98
88
  c[:xlc][:description] = description.strip
99
89
  end
100
90
  end
101
- rescue Errno::ENOENT
91
+ rescue Ohai::Exceptions::Exec
102
92
  end
103
93
 
104
94
  #sun pro
105
- begin
106
- so = shell_out("cc -V -flags")
107
- if so.exitstatus == 0
108
- output = so.stderr.split
109
- if so.stderr =~ /^cc: Sun C/ && output.size >= 4
110
- c[:sunpro] = Mash.new
111
- c[:sunpro][:version] = output[3]
112
- c[:sunpro][:description] = so.stderr.chomp
113
- end
95
+ collect("cc -V -flags") do |so|
96
+ output = so.stderr.split
97
+ if so.stderr =~ /^cc: Sun C/ && output.size >= 4
98
+ c[:sunpro] = Mash.new
99
+ c[:sunpro][:version] = output[3]
100
+ c[:sunpro][:description] = so.stderr.chomp
114
101
  end
115
- rescue Errno::ENOENT
116
102
  end
117
103
 
118
104
  #hpux cc
119
- begin
120
- so = shell_out("what /opt/ansic/bin/cc")
121
- if so.exitstatus == 0
122
- description = so.stdout.split($/).select { |line| line =~ /HP C Compiler/ }.first
123
- if description
124
- output = description.split
125
- c[:hpcc] = Mash.new
126
- c[:hpcc][:version] = output[1] if output.size >= 1
127
- c[:hpcc][:description] = description.strip
128
- end
105
+ collect("what /opt/ansic/bin/cc") do |so|
106
+ description = so.stdout.split($/).select { |line| line =~ /HP C Compiler/ }.first
107
+ if description
108
+ output = description.split
109
+ c[:hpcc] = Mash.new
110
+ c[:hpcc][:version] = output[1] if output.size >= 1
111
+ c[:hpcc][:description] = description.strip
129
112
  end
130
- rescue Errno::ENOENT
131
113
  end
132
114
 
133
115
  languages[:c] = c if c.keys.length > 0
@@ -30,7 +30,7 @@ Ohai.plugin(:Memory) do
30
30
  inactive = 0
31
31
  vm_stat = shell_out("vm_stat").stdout
32
32
  vm_stat_match = /page size of (\d+) bytes/.match(vm_stat)
33
- page_size = if vm_stat_match and vm_stat_match[1]
33
+ page_size = if vm_stat_match && vm_stat_match[1]
34
34
  vm_stat_match[1].to_i
35
35
  else
36
36
  4096
@@ -61,8 +61,8 @@ Ohai.plugin(:Network) do
61
61
 
62
62
  def scope_lookup(scope)
63
63
  return "Node" if scope.eql?("::1")
64
- return "Link" if scope.match(/^fe80\:/)
65
- return "Site" if scope.match(/^fec0\:/)
64
+ return "Link" if scope =~ /^fe80\:/
65
+ return "Site" if scope =~ /^fec0\:/
66
66
  "Global"
67
67
  end
68
68
 
@@ -73,7 +73,7 @@ Ohai.plugin(:Network) do
73
73
  def locate_interface(ifaces, ifname, mac)
74
74
  return ifname unless ifaces[ifname].nil?
75
75
  # oh well, time to go hunting!
76
- return ifname.chop if ifname.match /\*$/
76
+ return ifname.chop if ifname =~ /\*$/
77
77
  ifaces.keys.each do |ifc|
78
78
  ifaces[ifc][:addresses].keys.each do |addr|
79
79
  return ifc if addr.eql? mac
@@ -26,7 +26,7 @@ Ohai.plugin(:Platform) do
26
26
  when /^ProductName:\s+(.+)$/
27
27
  macname = $1
28
28
  macname.downcase!
29
- macname.gsub!(" ", "_")
29
+ macname.tr!(" ", "_")
30
30
  platform macname
31
31
  when /^ProductVersion:\s+(.+)$/
32
32
  platform_version $1
@@ -53,7 +53,7 @@ SPUSBData
53
53
  SPWWANData
54
54
  SPAirPortData},
55
55
  "full" => [
56
- "SPHardwareDataType"
56
+ "SPHardwareDataType",
57
57
  ],
58
58
  }
59
59
 
@@ -43,7 +43,7 @@ Ohai.plugin(:DigitalOcean) do
43
43
  address_hash = Mash.new({
44
44
  "ip_address" => ip.address,
45
45
  "type" => private_address?(ip.address) ? "private" : "public",
46
- },)
46
+ })
47
47
 
48
48
  if ip.ipv4?
49
49
  address_hash["netmask"] = details[:netmask]
@@ -2,6 +2,7 @@
2
2
  # Author:: Tim Dysinger (<tim@dysinger.net>)
3
3
  # Author:: Benjamin Black (<bb@chef.io>)
4
4
  # Author:: Christopher Brown (<cb@chef.io>)
5
+ # Author:: Tim Smith (<tsmith@chef.io>)
5
6
  # Copyright:: Copyright (c) 2009-2016 Chef Software, Inc.
6
7
  # License:: Apache License, Version 2.0
7
8
  #
@@ -17,6 +18,12 @@
17
18
  # See the License for the specific language governing permissions and
18
19
  # limitations under the License.
19
20
 
21
+ # How we detect EC2 from easiest to hardest & least reliable
22
+ # 1. Ohai ec2 hint exists. This always works
23
+ # 2. Xen hypervisor UUID starts with 'ec2'. This catches Linux HVM & paravirt instances
24
+ # 3. DMI data mentions amazon. This catches HVM instances in a VPC
25
+ # 4. Kernel data mentioned Amazon. This catches Windows HVM & paravirt instances
26
+
20
27
  require "ohai/mixin/ec2_metadata"
21
28
  require "base64"
22
29
 
@@ -25,65 +32,59 @@ Ohai.plugin(:EC2) do
25
32
 
26
33
  provides "ec2"
27
34
 
28
- depends "network/interfaces"
29
35
  depends "dmi"
30
-
31
- # look for ec2metadata which is included on paravirt / hvm AMIs
32
- def has_ec2metadata_bin?
33
- if File.exist?("/usr/bin/ec2metadata")
34
- Ohai::Log.debug("ec2 plugin: has_ec2metadata_bin? == true")
35
- true
36
- else
37
- Ohai::Log.debug("ec2 plugin: has_ec2metadata_bin? == false")
38
- false
39
- end
40
- end
41
-
42
- # look for arp address that non-VPC hosts will have
43
- def has_xen_mac?
44
- network[:interfaces].values.each do |iface|
45
- unless iface[:arp].nil?
46
- if iface[:arp].value?("fe:ff:ff:ff:ff:ff")
47
- # using MAC addresses from ARP is unreliable because they could time-out from the table
48
- # fe:ff:ff:ff:ff:ff is actually a sign of Xen, not specifically EC2
49
- deprecation_message <<-EOM
50
- ec2 plugin: Detected EC2 by the presence of fe:ff:ff:ff:ff:ff in the ARP table. This method is unreliable and will be removed in a future version of ohai. Bootstrap using knife-ec2 or create "/etc/chef/ohai/hints/ec2.json" instead.
51
- EOM
52
- Ohai::Log.warn(deprecation_message)
53
- Ohai::Log.debug("ec2 plugin: has_xen_mac? == true")
54
- return true
55
- end
56
- end
57
- end
58
- Ohai::Log.debug("ec2 plugin: has_xen_mac? == false")
59
- false
60
- end
36
+ depends "kernel"
61
37
 
62
38
  # look for amazon string in dmi bios data
63
- # this only works on hvm instances as paravirt instances have no dmi data
39
+ # this gets us detection of HVM instances that are within a VPC
64
40
  def has_ec2_dmi?
65
41
  begin
66
42
  # detect a version of '4.2.amazon'
67
43
  if dmi[:bios][:all_records][0][:Version] =~ /amazon/
68
44
  Ohai::Log.debug("ec2 plugin: has_ec2_dmi? == true")
69
- true
45
+ return true
70
46
  end
71
47
  rescue NoMethodError
72
- Ohai::Log.debug("ec2 plugin: has_ec2_dmi? == false")
73
- false
48
+ # dmi[:bios][:all_records][0][:Version] may not exist
49
+ end
50
+ Ohai::Log.debug("ec2 plugin: has_ec2_dmi? == false")
51
+ return false
52
+ end
53
+
54
+ # looks for a xen UUID that starts with ec2
55
+ # this gets us detection of Linux HVM and Paravirt hosts
56
+ def has_ec2_xen_uuid?
57
+ if ::File.exist?("/sys/hypervisor/uuid")
58
+ if ::File.read("/sys/hypervisor/uuid") =~ /^ec2/
59
+ Ohai::Log.debug("ec2 plugin: has_ec2_xen_uuid? == true")
60
+ return true
61
+ end
74
62
  end
63
+ Ohai::Log.debug("ec2 plugin: has_ec2_xen_uuid? == false")
64
+ return false
75
65
  end
76
66
 
77
- # rackspace systems look like ec2 so instead of timing out dig a bit deeper
78
- def looks_like_rackspace?
79
- return true if File.exist?("/usr/bin/rackspace-monitoring-agent")
67
+ # looks for the Amazon.com Organization in Windows Kernel data
68
+ # this gets us detection of Windows systems
69
+ def has_amazon_org?
70
+ begin
71
+ # detect an Organization of 'Amazon.com'
72
+ if kernel[:os_info][:organization] =~ /Amazon/
73
+ Ohai::Log.debug("ec2 plugin: has_amazon_org? == true")
74
+ return true
75
+ end
76
+ rescue NoMethodError
77
+ # kernel[:os_info][:organization] may not exist
78
+ end
79
+ Ohai::Log.debug("ec2 plugin: has_amazon_org? == false")
80
+ return false
80
81
  end
81
82
 
82
83
  def looks_like_ec2?
83
84
  return true if hint?("ec2")
84
85
 
85
86
  # Even if it looks like EC2 try to connect first
86
- if has_ec2_dmi? || has_xen_mac? || (has_ec2metadata_bin? && !looks_like_rackspace?)
87
+ if has_ec2_xen_uuid? || has_ec2_dmi? || has_amazon_org?
87
88
  return true if can_metadata_connect?(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80)
88
89
  end
89
90
  end
@@ -100,7 +101,7 @@ EOM
100
101
  next if k == "iam" && !hint?("iam")
101
102
  ec2[k] = v
102
103
  end
103
- ec2[:userdata] = self.fetch_userdata
104
+ ec2[:userdata] = fetch_userdata
104
105
  # ASCII-8BIT is equivalent to BINARY in this case
105
106
  if ec2[:userdata] && ec2[:userdata].encoding.to_s == "ASCII-8BIT"
106
107
  Ohai::Log.debug("ec2 plugin: Binary UserData Found. Storing in base64")