ohai 14.2.0 → 14.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/ohai/application.rb +29 -29
  5. data/lib/ohai/common/dmi.rb +5 -5
  6. data/lib/ohai/dsl/plugin.rb +3 -3
  7. data/lib/ohai/dsl/plugin/versionvii.rb +3 -3
  8. data/lib/ohai/mixin/azure_metadata.rb +2 -2
  9. data/lib/ohai/mixin/do_metadata.rb +3 -3
  10. data/lib/ohai/mixin/ec2_metadata.rb +8 -8
  11. data/lib/ohai/mixin/gce_metadata.rb +2 -2
  12. data/lib/ohai/mixin/network_constants.rb +1 -1
  13. data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
  14. data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
  15. data/lib/ohai/mixin/string.rb +2 -2
  16. data/lib/ohai/plugins/aix/cpu.rb +3 -3
  17. data/lib/ohai/plugins/aix/filesystem.rb +1 -1
  18. data/lib/ohai/plugins/aix/kernel.rb +1 -1
  19. data/lib/ohai/plugins/aix/memory.rb +1 -1
  20. data/lib/ohai/plugins/aix/network.rb +3 -3
  21. data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
  22. data/lib/ohai/plugins/cloud.rb +1 -1
  23. data/lib/ohai/plugins/darwin/hardware.rb +1 -1
  24. data/lib/ohai/plugins/darwin/network.rb +5 -5
  25. data/lib/ohai/plugins/darwin/platform.rb +1 -1
  26. data/lib/ohai/plugins/dmi.rb +6 -6
  27. data/lib/ohai/plugins/filesystem.rb +5 -5
  28. data/lib/ohai/plugins/hostname.rb +5 -5
  29. data/lib/ohai/plugins/kernel.rb +8 -8
  30. data/lib/ohai/plugins/linux/lspci.rb +4 -4
  31. data/lib/ohai/plugins/linux/memory.rb +4 -4
  32. data/lib/ohai/plugins/linux/network.rb +16 -16
  33. data/lib/ohai/plugins/linux/platform.rb +7 -1
  34. data/lib/ohai/plugins/netbsd/network.rb +1 -1
  35. data/lib/ohai/plugins/network.rb +5 -5
  36. data/lib/ohai/plugins/openbsd/network.rb +1 -1
  37. data/lib/ohai/plugins/packages.rb +1 -1
  38. data/lib/ohai/plugins/passwd.rb +4 -4
  39. data/lib/ohai/plugins/ruby.rb +13 -13
  40. data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
  41. data/lib/ohai/plugins/solaris2/filesystem.rb +6 -6
  42. data/lib/ohai/plugins/solaris2/memory.rb +2 -2
  43. data/lib/ohai/plugins/solaris2/network.rb +36 -36
  44. data/lib/ohai/plugins/windows/network.rb +2 -2
  45. data/lib/ohai/util/win32/group_helper.rb +1 -1
  46. data/lib/ohai/version.rb +1 -1
  47. data/spec/functional/application_spec.rb +6 -6
  48. data/spec/functional/loader_spec.rb +4 -4
  49. data/spec/functional/plugins/windows/uptime_spec.rb +1 -2
  50. data/spec/spec_helper.rb +5 -5
  51. data/spec/unit/application_spec.rb +11 -11
  52. data/spec/unit/config_spec.rb +5 -5
  53. data/spec/unit/dsl/plugin_spec.rb +5 -5
  54. data/spec/unit/hints_spec.rb +2 -2
  55. data/spec/unit/loader_spec.rb +41 -41
  56. data/spec/unit/mixin/azure_metadata_spec.rb +3 -3
  57. data/spec/unit/mixin/command_spec.rb +64 -64
  58. data/spec/unit/mixin/ec2_metadata_spec.rb +6 -6
  59. data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
  60. data/spec/unit/plugin_config_spec.rb +9 -9
  61. data/spec/unit/plugins/abort_spec.rb +6 -6
  62. data/spec/unit/plugins/aix/cpu_spec.rb +16 -16
  63. data/spec/unit/plugins/aix/filesystem_spec.rb +57 -57
  64. data/spec/unit/plugins/aix/network_spec.rb +35 -35
  65. data/spec/unit/plugins/aix/virtualization_spec.rb +210 -210
  66. data/spec/unit/plugins/azure_spec.rb +49 -49
  67. data/spec/unit/plugins/bsd/filesystem_spec.rb +13 -13
  68. data/spec/unit/plugins/bsd/virtualization_spec.rb +10 -10
  69. data/spec/unit/plugins/c_spec.rb +54 -54
  70. data/spec/unit/plugins/chef_spec.rb +3 -3
  71. data/spec/unit/plugins/darwin/cpu_spec.rb +54 -54
  72. data/spec/unit/plugins/darwin/filesystem_spec.rb +34 -34
  73. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +1070 -1070
  74. data/spec/unit/plugins/darwin/memory_spec.rb +16 -16
  75. data/spec/unit/plugins/darwin/network_spec.rb +382 -382
  76. data/spec/unit/plugins/digital_ocean_spec.rb +7 -7
  77. data/spec/unit/plugins/dmi_spec.rb +83 -83
  78. data/spec/unit/plugins/docker_spec.rb +2 -2
  79. data/spec/unit/plugins/ec2_spec.rb +156 -156
  80. data/spec/unit/plugins/eucalyptus_spec.rb +19 -19
  81. data/spec/unit/plugins/fail_spec.rb +14 -14
  82. data/spec/unit/plugins/freebsd/cpu_spec.rb +18 -18
  83. data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
  84. data/spec/unit/plugins/gce_spec.rb +1 -1
  85. data/spec/unit/plugins/init_package_spec.rb +1 -1
  86. data/spec/unit/plugins/java_spec.rb +4 -4
  87. data/spec/unit/plugins/joyent_spec.rb +9 -9
  88. data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
  89. data/spec/unit/plugins/linux/cpu_spec.rb +155 -155
  90. data/spec/unit/plugins/linux/filesystem_spec.rb +229 -229
  91. data/spec/unit/plugins/linux/kernel_spec.rb +9 -9
  92. data/spec/unit/plugins/linux/lsb_spec.rb +18 -18
  93. data/spec/unit/plugins/linux/lspci_spec.rb +58 -58
  94. data/spec/unit/plugins/linux/mdadm_spec.rb +54 -54
  95. data/spec/unit/plugins/linux/memory_spec.rb +35 -35
  96. data/spec/unit/plugins/linux/network_spec.rb +464 -464
  97. data/spec/unit/plugins/linux/platform_spec.rb +84 -68
  98. data/spec/unit/plugins/linux/systemd_paths_spec.rb +40 -40
  99. data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
  100. data/spec/unit/plugins/linux/virtualization_spec.rb +197 -197
  101. data/spec/unit/plugins/mono_spec.rb +11 -11
  102. data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
  103. data/spec/unit/plugins/network_spec.rb +2 -2
  104. data/spec/unit/plugins/openstack_spec.rb +43 -43
  105. data/spec/unit/plugins/os_spec.rb +1 -1
  106. data/spec/unit/plugins/passwd_spec.rb +9 -9
  107. data/spec/unit/plugins/php_spec.rb +22 -22
  108. data/spec/unit/plugins/powershell_spec.rb +13 -13
  109. data/spec/unit/plugins/rackspace_spec.rb +38 -38
  110. data/spec/unit/plugins/ruby_spec.rb +14 -14
  111. data/spec/unit/plugins/scaleway_spec.rb +6 -6
  112. data/spec/unit/plugins/scsi_spec.rb +7 -7
  113. data/spec/unit/plugins/solaris2/cpu_spec.rb +2594 -2594
  114. data/spec/unit/plugins/solaris2/dmi_spec.rb +91 -91
  115. data/spec/unit/plugins/solaris2/filesystem.rb +8 -8
  116. data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
  117. data/spec/unit/plugins/solaris2/network_spec.rb +92 -93
  118. data/spec/unit/plugins/solaris2/platform_spec.rb +24 -24
  119. data/spec/unit/plugins/solaris2/virtualization_spec.rb +22 -22
  120. data/spec/unit/plugins/ssh_host_keys_spec.rb +12 -12
  121. data/spec/unit/plugins/sysconf_spec.rb +321 -321
  122. data/spec/unit/plugins/virtualbox_spec.rb +27 -27
  123. data/spec/unit/plugins/windows/cpu_spec.rb +9 -9
  124. data/spec/unit/plugins/windows/kernel_spec.rb +12 -12
  125. data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
  126. data/spec/unit/plugins/zpools_spec.rb +41 -41
  127. data/spec/unit/runner_spec.rb +2 -2
  128. data/spec/unit/system_spec.rb +55 -55
  129. metadata +3 -4
  130. data/docs/man/man1/ohai.1 +0 -97
@@ -62,9 +62,9 @@ describe Ohai::System, "plugin digital_ocean" do
62
62
  end
63
63
 
64
64
  it "should fetch and properly parse json metadata" do
65
- expect(@http_client).to receive(:get).
66
- with("/metadata/v1.json").
67
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
65
+ expect(@http_client).to receive(:get)
66
+ .with("/metadata/v1.json")
67
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
68
68
  plugin.run
69
69
 
70
70
  expect(plugin[:digital_ocean]).not_to be_nil
@@ -73,9 +73,9 @@ describe Ohai::System, "plugin digital_ocean" do
73
73
  end
74
74
 
75
75
  it "should complete the run despite unavailable metadata" do
76
- expect(@http_client).to receive(:get).
77
- with("/metadata/v1.json").
78
- and_return(double("Net::HTTP Response", :body => "", :code => "404"))
76
+ expect(@http_client).to receive(:get)
77
+ .with("/metadata/v1.json")
78
+ .and_return(double("Net::HTTP Response", body: "", code: "404"))
79
79
  plugin.run
80
80
 
81
81
  expect(plugin[:digitalocean]).to be_nil
@@ -98,7 +98,7 @@ describe Ohai::System, "plugin digital_ocean" do
98
98
  it_should_behave_like "digital_ocean"
99
99
 
100
100
  before(:each) do
101
- plugin[:dmi] = { :bios => { :all_records => [ { :Vendor => "DigitalOcean" } ] } }
101
+ plugin[:dmi] = { bios: { all_records: [ { Vendor: "DigitalOcean" } ] } }
102
102
  end
103
103
  end
104
104
  end
@@ -19,85 +19,85 @@
19
19
  require_relative "../../spec_helper.rb"
20
20
 
21
21
  # NOTE: These data lines must be prefixed with one or two tabs, not spaces.
22
- DMI_OUT = <<-EOS
23
- # dmidecode 2.9
24
- SMBIOS 2.4 present.
25
- 98 structures occupying 3699 bytes.
26
- Table at 0x000E0010.
22
+ DMI_OUT = <<~EOS.freeze
23
+ # dmidecode 2.9
24
+ SMBIOS 2.4 present.
25
+ 98 structures occupying 3699 bytes.
26
+ Table at 0x000E0010.
27
27
 
28
- Handle 0x0000, DMI type 0, 24 bytes
29
- BIOS Information
30
- Vendor: Phoenix Technologies LTD
31
- Version: 6.00
32
- Release Date: 12/31/2009
33
- Address: 0xEA2E0
34
- Runtime Size: 89376 bytes
35
- ROM Size: 64 kB
36
- Characteristics:
37
- ISA is supported
38
- PCI is supported
39
- PC Card (PCMCIA) is supported
40
- PNP is supported
41
- APM is supported
42
- BIOS is upgradeable
43
- BIOS shadowing is allowed
44
- ESCD support is available
45
- USB legacy is supported
46
- Smart battery is supported
47
- BIOS boot specification is supported
48
- Targeted content distribution is supported
49
- BIOS Revision: 4.6
50
- Firmware Revision: 0.0
28
+ Handle 0x0000, DMI type 0, 24 bytes
29
+ BIOS Information
30
+ Vendor: Phoenix Technologies LTD
31
+ Version: 6.00
32
+ Release Date: 12/31/2009
33
+ Address: 0xEA2E0
34
+ Runtime Size: 89376 bytes
35
+ ROM Size: 64 kB
36
+ Characteristics:
37
+ ISA is supported
38
+ PCI is supported
39
+ PC Card (PCMCIA) is supported
40
+ PNP is supported
41
+ APM is supported
42
+ BIOS is upgradeable
43
+ BIOS shadowing is allowed
44
+ ESCD support is available
45
+ USB legacy is supported
46
+ Smart battery is supported
47
+ BIOS boot specification is supported
48
+ Targeted content distribution is supported
49
+ BIOS Revision: 4.6
50
+ Firmware Revision: 0.0
51
51
 
52
- Handle 0x0001, DMI type 1, 27 bytes
53
- System Information
54
- Manufacturer: VMware, Inc.
55
- Product Name: VMware Virtual Platform
56
- Version: None
57
- Serial Number: VMware-56 4d 71 d1 65 70 83 a8-df c8 14 12 19 41 71 45
58
- UUID: 564D71D1-6570-83A8-DFC8-141219417145
59
- Wake-up Type: Power Switch
60
- SKU Number: Not Specified
61
- Family: Not Specified
52
+ Handle 0x0001, DMI type 1, 27 bytes
53
+ System Information
54
+ Manufacturer: VMware, Inc.
55
+ Product Name: VMware Virtual Platform
56
+ Version: None
57
+ Serial Number: VMware-56 4d 71 d1 65 70 83 a8-df c8 14 12 19 41 71 45
58
+ UUID: 564D71D1-6570-83A8-DFC8-141219417145
59
+ Wake-up Type: Power Switch
60
+ SKU Number: Not Specified
61
+ Family: Not Specified
62
62
 
63
- Handle 0x0002, DMI type 2, 15 bytes
64
- Base Board Information
65
- Manufacturer: Intel Corporation
66
- Product Name: 440BX Desktop Reference Platform
67
- Version: None
68
- Serial Number: None
69
- Asset Tag: Not Specified
70
- Features: None
71
- Location In Chassis: Not Specified
72
- Chassis Handle: 0x0000
73
- Type: Unknown
74
- Contained Object Handles: 0
63
+ Handle 0x0002, DMI type 2, 15 bytes
64
+ Base Board Information
65
+ Manufacturer: Intel Corporation
66
+ Product Name: 440BX Desktop Reference Platform
67
+ Version: None
68
+ Serial Number: None
69
+ Asset Tag: Not Specified
70
+ Features: None
71
+ Location In Chassis: Not Specified
72
+ Chassis Handle: 0x0000
73
+ Type: Unknown
74
+ Contained Object Handles: 0
75
75
 
76
- Handle 0x1000, DMI type 16, 15 bytes
77
- Physical Memory Array
78
- Location: Other
79
- Use: System Memory
80
- Error Correction Type: Multi-bit ECC
81
- Maximum Capacity: 2 GB
82
- Error Information Handle: Not Provided
83
- Number Of Devices: 1
76
+ Handle 0x1000, DMI type 16, 15 bytes
77
+ Physical Memory Array
78
+ Location: Other
79
+ Use: System Memory
80
+ Error Correction Type: Multi-bit ECC
81
+ Maximum Capacity: 2 GB
82
+ Error Information Handle: Not Provided
83
+ Number Of Devices: 1
84
84
 
85
- Handle 0x0003, DMI type 3, 21 bytes
86
- Chassis Information
87
- Manufacturer: No Enclosure
88
- Type: Other
89
- Lock: Not Present
90
- Version: N/A
91
- Serial Number: None
92
- Asset Tag: No Asset Tag
93
- Boot-up State: Safe
94
- Power Supply State: Safe
95
- Thermal State: Safe
96
- Security Status: None
97
- OEM Information: 0x00001234
98
- Height: Unspecified
99
- Number Of Power Cords: Unspecified
100
- Contained Elements: 0
85
+ Handle 0x0003, DMI type 3, 21 bytes
86
+ Chassis Information
87
+ Manufacturer: No Enclosure
88
+ Type: Other
89
+ Lock: Not Present
90
+ Version: N/A
91
+ Serial Number: None
92
+ Asset Tag: No Asset Tag
93
+ Boot-up State: Safe
94
+ Power Supply State: Safe
95
+ Thermal State: Safe
96
+ Security Status: None
97
+ OEM Information: 0x00001234
98
+ Height: Unspecified
99
+ Number Of Power Cords: Unspecified
100
+ Contained Elements: 0
101
101
  EOS
102
102
 
103
103
  describe Ohai::System, "plugin dmi" do
@@ -115,17 +115,17 @@ describe Ohai::System, "plugin dmi" do
115
115
 
116
116
  # Test some simple sample data
117
117
  {
118
- :bios => {
119
- :vendor => "Phoenix Technologies LTD",
120
- :release_date => "12/31/2009",
118
+ bios: {
119
+ vendor: "Phoenix Technologies LTD",
120
+ release_date: "12/31/2009",
121
121
  },
122
- :system => {
123
- :manufacturer => "VMware, Inc.",
124
- :product_name => "VMware Virtual Platform",
122
+ system: {
123
+ manufacturer: "VMware, Inc.",
124
+ product_name: "VMware Virtual Platform",
125
125
  },
126
- :chassis => {
127
- :lock => "Not Present",
128
- :asset_tag => "No Asset Tag",
126
+ chassis: {
127
+ lock: "Not Present",
128
+ asset_tag: "No Asset Tag",
129
129
  },
130
130
  }.each do |id, data|
131
131
  data.each do |attribute, value|
@@ -16,8 +16,8 @@
16
16
 
17
17
  require_relative "../../spec_helper.rb"
18
18
 
19
- docker_output = <<EOF
20
- {"ID":"KZET:VDFN:2V2G:JS5Z:HAKO:SOGI:AFSZ:HDMT:GVEM:V2NT:DUSW:J3Z6","Containers":11,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":11,"Images":30,"Driver":"overlay2","DriverStatus":[["Backing Filesystem","extfs"],["Supports d_type","true"],["Native Overlay Diff","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","ipvlan","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":21,"OomKillDisable":true,"NGoroutines":39,"SystemTime":"2018-02-15T19:12:40.214106068Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":2,"KernelVersion":"4.9.60-linuxkit-aufs","OperatingSystem":"Docker for Mac","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":[],"AllowNondistributableArtifactsHostnames":[],"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":[],"Secure":true,"Official":true}},"Mirrors":[]},"NCPU":4,"MemTotal":2095816704,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"docker.for.mac.http.internal:3128","HttpsProxy":"docker.for.mac.http.internal:3129","NoProxy":"","Name":"linuxkit-025000000001","Labels":[],"ExperimentalBuild":true,"ServerVersion":"17.12.0-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"89623f28b87a6004d4b785663257362d1658a729","Expected":"89623f28b87a6004d4b785663257362d1658a729"},"RuncCommit":{"ID":"b2567b37d7b75eb4cf325b77297b140ea686ce8f","Expected":"b2567b37d7b75eb4cf325b77297b140ea686ce8f"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=seccomp,profile=default"]}
19
+ docker_output = <<~EOF
20
+ {"ID":"KZET:VDFN:2V2G:JS5Z:HAKO:SOGI:AFSZ:HDMT:GVEM:V2NT:DUSW:J3Z6","Containers":11,"ContainersRunning":0,"ContainersPaused":0,"ContainersStopped":11,"Images":30,"Driver":"overlay2","DriverStatus":[["Backing Filesystem","extfs"],["Supports d_type","true"],["Native Overlay Diff","true"]],"SystemStatus":null,"Plugins":{"Volume":["local"],"Network":["bridge","host","ipvlan","macvlan","null","overlay"],"Authorization":null,"Log":["awslogs","fluentd","gcplogs","gelf","journald","json-file","logentries","splunk","syslog"]},"MemoryLimit":true,"SwapLimit":true,"KernelMemory":true,"CpuCfsPeriod":true,"CpuCfsQuota":true,"CPUShares":true,"CPUSet":true,"IPv4Forwarding":true,"BridgeNfIptables":true,"BridgeNfIp6tables":true,"Debug":true,"NFd":21,"OomKillDisable":true,"NGoroutines":39,"SystemTime":"2018-02-15T19:12:40.214106068Z","LoggingDriver":"json-file","CgroupDriver":"cgroupfs","NEventsListener":2,"KernelVersion":"4.9.60-linuxkit-aufs","OperatingSystem":"Docker for Mac","OSType":"linux","Architecture":"x86_64","IndexServerAddress":"https://index.docker.io/v1/","RegistryConfig":{"AllowNondistributableArtifactsCIDRs":[],"AllowNondistributableArtifactsHostnames":[],"InsecureRegistryCIDRs":["127.0.0.0/8"],"IndexConfigs":{"docker.io":{"Name":"docker.io","Mirrors":[],"Secure":true,"Official":true}},"Mirrors":[]},"NCPU":4,"MemTotal":2095816704,"GenericResources":null,"DockerRootDir":"/var/lib/docker","HttpProxy":"docker.for.mac.http.internal:3128","HttpsProxy":"docker.for.mac.http.internal:3129","NoProxy":"","Name":"linuxkit-025000000001","Labels":[],"ExperimentalBuild":true,"ServerVersion":"17.12.0-ce","ClusterStore":"","ClusterAdvertise":"","Runtimes":{"runc":{"path":"docker-runc"}},"DefaultRuntime":"runc","Swarm":{"NodeID":"","NodeAddr":"","LocalNodeState":"inactive","ControlAvailable":false,"Error":"","RemoteManagers":null},"LiveRestoreEnabled":false,"Isolation":"","InitBinary":"docker-init","ContainerdCommit":{"ID":"89623f28b87a6004d4b785663257362d1658a729","Expected":"89623f28b87a6004d4b785663257362d1658a729"},"RuncCommit":{"ID":"b2567b37d7b75eb4cf325b77297b140ea686ce8f","Expected":"b2567b37d7b75eb4cf325b77297b140ea686ce8f"},"InitCommit":{"ID":"949e6fa","Expected":"949e6fa"},"SecurityOptions":["name=seccomp,profile=default"]}
21
21
  EOF
22
22
 
23
23
  expected_output = {
@@ -48,9 +48,9 @@ describe Ohai::System, "plugin ec2" do
48
48
  t = double("connection")
49
49
  allow(t).to receive(:connect_nonblock).and_raise(Errno::EINPROGRESS)
50
50
  allow(Socket).to receive(:new).and_return(t)
51
- expect(@http_client).to receive(:get).
52
- with("/").
53
- and_return(double("Net::HTTP Response", :body => "2012-01-12", :code => "200"))
51
+ expect(@http_client).to receive(:get)
52
+ .with("/")
53
+ .and_return(double("Net::HTTP Response", body: "2012-01-12", code: "200"))
54
54
  end
55
55
 
56
56
  context "with common metadata paths" do
@@ -64,16 +64,16 @@ describe Ohai::System, "plugin ec2" do
64
64
 
65
65
  it "recursively fetches all the ec2 metadata" do
66
66
  paths.each do |name, body|
67
- expect(@http_client).to receive(:get).
68
- with("/2012-01-12/#{name}").
69
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
67
+ expect(@http_client).to receive(:get)
68
+ .with("/2012-01-12/#{name}")
69
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
70
70
  end
71
- expect(@http_client).to receive(:get).
72
- with("/2012-01-12/user-data/").
73
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
74
- expect(@http_client).to receive(:get).
75
- with("/2012-01-12/dynamic/instance-identity/document/").
76
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
71
+ expect(@http_client).to receive(:get)
72
+ .with("/2012-01-12/user-data/")
73
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
74
+ expect(@http_client).to receive(:get)
75
+ .with("/2012-01-12/dynamic/instance-identity/document/")
76
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
77
77
 
78
78
  plugin.run
79
79
 
@@ -85,16 +85,16 @@ describe Ohai::System, "plugin ec2" do
85
85
 
86
86
  it "fetches binary userdata opaquely" do
87
87
  paths.each do |name, body|
88
- expect(@http_client).to receive(:get).
89
- with("/2012-01-12/#{name}").
90
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
88
+ expect(@http_client).to receive(:get)
89
+ .with("/2012-01-12/#{name}")
90
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
91
91
  end
92
- expect(@http_client).to receive(:get).
93
- with("/2012-01-12/user-data/").
94
- and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
95
- expect(@http_client).to receive(:get).
96
- with("/2012-01-12/dynamic/instance-identity/document/").
97
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
92
+ expect(@http_client).to receive(:get)
93
+ .with("/2012-01-12/user-data/")
94
+ .and_return(double("Net::HTTP Response", body: "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", code: "200"))
95
+ expect(@http_client).to receive(:get)
96
+ .with("/2012-01-12/dynamic/instance-identity/document/")
97
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
98
98
 
99
99
  plugin.run
100
100
 
@@ -107,16 +107,16 @@ describe Ohai::System, "plugin ec2" do
107
107
 
108
108
  it "fetches AWS account id" do
109
109
  paths.each do |name, body|
110
- expect(@http_client).to receive(:get).
111
- with("/2012-01-12/#{name}").
112
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
110
+ expect(@http_client).to receive(:get)
111
+ .with("/2012-01-12/#{name}")
112
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
113
113
  end
114
- expect(@http_client).to receive(:get).
115
- with("/2012-01-12/user-data/").
116
- and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
117
- expect(@http_client).to receive(:get).
118
- with("/2012-01-12/dynamic/instance-identity/document/").
119
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
114
+ expect(@http_client).to receive(:get)
115
+ .with("/2012-01-12/user-data/")
116
+ .and_return(double("Net::HTTP Response", body: "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", code: "200"))
117
+ expect(@http_client).to receive(:get)
118
+ .with("/2012-01-12/dynamic/instance-identity/document/")
119
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
120
120
 
121
121
  plugin.run
122
122
 
@@ -129,16 +129,16 @@ describe Ohai::System, "plugin ec2" do
129
129
 
130
130
  it "fetches AWS region" do
131
131
  paths.each do |name, body|
132
- expect(@http_client).to receive(:get).
133
- with("/2012-01-12/#{name}").
134
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
132
+ expect(@http_client).to receive(:get)
133
+ .with("/2012-01-12/#{name}")
134
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
135
135
  end
136
- expect(@http_client).to receive(:get).
137
- with("/2012-01-12/user-data/").
138
- and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
139
- expect(@http_client).to receive(:get).
140
- with("/2012-01-12/dynamic/instance-identity/document/").
141
- and_return(double("Net::HTTP Response", :body => "{\"region\":\"us-east-1\"}", :code => "200"))
136
+ expect(@http_client).to receive(:get)
137
+ .with("/2012-01-12/user-data/")
138
+ .and_return(double("Net::HTTP Response", body: "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", code: "200"))
139
+ expect(@http_client).to receive(:get)
140
+ .with("/2012-01-12/dynamic/instance-identity/document/")
141
+ .and_return(double("Net::HTTP Response", body: "{\"region\":\"us-east-1\"}", code: "200"))
142
142
 
143
143
  plugin.run
144
144
 
@@ -151,16 +151,16 @@ describe Ohai::System, "plugin ec2" do
151
151
 
152
152
  it "fetches AWS availability zone" do
153
153
  paths.each do |name, body|
154
- expect(@http_client).to receive(:get).
155
- with("/2012-01-12/#{name}").
156
- and_return(double("Net::HTTP Response", :body => body, :code => "200"))
154
+ expect(@http_client).to receive(:get)
155
+ .with("/2012-01-12/#{name}")
156
+ .and_return(double("Net::HTTP Response", body: body, code: "200"))
157
157
  end
158
- expect(@http_client).to receive(:get).
159
- with("/2012-01-12/user-data/").
160
- and_return(double("Net::HTTP Response", :body => "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", :code => "200"))
161
- expect(@http_client).to receive(:get).
162
- with("/2012-01-12/dynamic/instance-identity/document/").
163
- and_return(double("Net::HTTP Response", :body => "{\"availabilityZone\":\"us-east-1d\"}", :code => "200"))
158
+ expect(@http_client).to receive(:get)
159
+ .with("/2012-01-12/user-data/")
160
+ .and_return(double("Net::HTTP Response", body: "^_<8B>^H^H<C7>U^@^Csomething^@KT<C8><C9>,)<C9>IU(I-.I<CB><CC>I<E5>^B^@^Qz<BF><B0>^R^@^@^@", code: "200"))
161
+ expect(@http_client).to receive(:get)
162
+ .with("/2012-01-12/dynamic/instance-identity/document/")
163
+ .and_return(double("Net::HTTP Response", body: "{\"availabilityZone\":\"us-east-1d\"}", code: "200"))
164
164
 
165
165
  plugin.run
166
166
 
@@ -173,30 +173,30 @@ describe Ohai::System, "plugin ec2" do
173
173
  end
174
174
 
175
175
  it "parses ec2 network/ directory as a multi-level hash" do
176
- expect(@http_client).to receive(:get).
177
- with("/2012-01-12/meta-data/").
178
- and_return(double("Net::HTTP Response", :body => "network/", :code => "200"))
179
- expect(@http_client).to receive(:get).
180
- with("/2012-01-12/meta-data/network/").
181
- and_return(double("Net::HTTP Response", :body => "interfaces/", :code => "200"))
182
- expect(@http_client).to receive(:get).
183
- with("/2012-01-12/meta-data/network/interfaces/").
184
- and_return(double("Net::HTTP Response", :body => "macs/", :code => "200"))
185
- expect(@http_client).to receive(:get).
186
- with("/2012-01-12/meta-data/network/interfaces/macs/").
187
- and_return(double("Net::HTTP Response", :body => "12:34:56:78:9a:bc/", :code => "200"))
188
- expect(@http_client).to receive(:get).
189
- with("/2012-01-12/meta-data/network/interfaces/macs/12:34:56:78:9a:bc/").
190
- and_return(double("Net::HTTP Response", :body => "public_hostname", :code => "200"))
191
- expect(@http_client).to receive(:get).
192
- with("/2012-01-12/meta-data/network/interfaces/macs/12:34:56:78:9a:bc/public_hostname").
193
- and_return(double("Net::HTTP Response", :body => "server17.opscode.com", :code => "200"))
194
- expect(@http_client).to receive(:get).
195
- with("/2012-01-12/user-data/").
196
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
197
- expect(@http_client).to receive(:get).
198
- with("/2012-01-12/dynamic/instance-identity/document/").
199
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
176
+ expect(@http_client).to receive(:get)
177
+ .with("/2012-01-12/meta-data/")
178
+ .and_return(double("Net::HTTP Response", body: "network/", code: "200"))
179
+ expect(@http_client).to receive(:get)
180
+ .with("/2012-01-12/meta-data/network/")
181
+ .and_return(double("Net::HTTP Response", body: "interfaces/", code: "200"))
182
+ expect(@http_client).to receive(:get)
183
+ .with("/2012-01-12/meta-data/network/interfaces/")
184
+ .and_return(double("Net::HTTP Response", body: "macs/", code: "200"))
185
+ expect(@http_client).to receive(:get)
186
+ .with("/2012-01-12/meta-data/network/interfaces/macs/")
187
+ .and_return(double("Net::HTTP Response", body: "12:34:56:78:9a:bc/", code: "200"))
188
+ expect(@http_client).to receive(:get)
189
+ .with("/2012-01-12/meta-data/network/interfaces/macs/12:34:56:78:9a:bc/")
190
+ .and_return(double("Net::HTTP Response", body: "public_hostname", code: "200"))
191
+ expect(@http_client).to receive(:get)
192
+ .with("/2012-01-12/meta-data/network/interfaces/macs/12:34:56:78:9a:bc/public_hostname")
193
+ .and_return(double("Net::HTTP Response", body: "server17.opscode.com", code: "200"))
194
+ expect(@http_client).to receive(:get)
195
+ .with("/2012-01-12/user-data/")
196
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
197
+ expect(@http_client).to receive(:get)
198
+ .with("/2012-01-12/dynamic/instance-identity/document/")
199
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
200
200
 
201
201
  plugin.run
202
202
 
@@ -210,24 +210,24 @@ describe Ohai::System, "plugin ec2" do
210
210
  end
211
211
 
212
212
  it "parses ec2 iam/ directory and collect iam/security-credentials/" do
213
- expect(@http_client).to receive(:get).
214
- with("/2012-01-12/meta-data/").
215
- and_return(double("Net::HTTP Response", :body => "iam/", :code => "200"))
216
- expect(@http_client).to receive(:get).
217
- with("/2012-01-12/meta-data/iam/").
218
- and_return(double("Net::HTTP Response", :body => "security-credentials/", :code => "200"))
219
- expect(@http_client).to receive(:get).
220
- with("/2012-01-12/meta-data/iam/security-credentials/").
221
- and_return(double("Net::HTTP Response", :body => "MyRole", :code => "200"))
222
- expect(@http_client).to receive(:get).
223
- with("/2012-01-12/meta-data/iam/security-credentials/MyRole").
224
- and_return(double("Net::HTTP Response", :body => "{\n \"Code\" : \"Success\",\n \"LastUpdated\" : \"2012-08-22T07:47:22Z\",\n \"Type\" : \"AWS-HMAC\",\n \"AccessKeyId\" : \"AAAAAAAA\",\n \"SecretAccessKey\" : \"SSSSSSSS\",\n \"Token\" : \"12345678\",\n \"Expiration\" : \"2012-08-22T11:25:52Z\"\n}", :code => "200"))
225
- expect(@http_client).to receive(:get).
226
- with("/2012-01-12/user-data/").
227
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
228
- expect(@http_client).to receive(:get).
229
- with("/2012-01-12/dynamic/instance-identity/document/").
230
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
213
+ expect(@http_client).to receive(:get)
214
+ .with("/2012-01-12/meta-data/")
215
+ .and_return(double("Net::HTTP Response", body: "iam/", code: "200"))
216
+ expect(@http_client).to receive(:get)
217
+ .with("/2012-01-12/meta-data/iam/")
218
+ .and_return(double("Net::HTTP Response", body: "security-credentials/", code: "200"))
219
+ expect(@http_client).to receive(:get)
220
+ .with("/2012-01-12/meta-data/iam/security-credentials/")
221
+ .and_return(double("Net::HTTP Response", body: "MyRole", code: "200"))
222
+ expect(@http_client).to receive(:get)
223
+ .with("/2012-01-12/meta-data/iam/security-credentials/MyRole")
224
+ .and_return(double("Net::HTTP Response", body: "{\n \"Code\" : \"Success\",\n \"LastUpdated\" : \"2012-08-22T07:47:22Z\",\n \"Type\" : \"AWS-HMAC\",\n \"AccessKeyId\" : \"AAAAAAAA\",\n \"SecretAccessKey\" : \"SSSSSSSS\",\n \"Token\" : \"12345678\",\n \"Expiration\" : \"2012-08-22T11:25:52Z\"\n}", code: "200"))
225
+ expect(@http_client).to receive(:get)
226
+ .with("/2012-01-12/user-data/")
227
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
228
+ expect(@http_client).to receive(:get)
229
+ .with("/2012-01-12/dynamic/instance-identity/document/")
230
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
231
231
 
232
232
  plugin.run
233
233
 
@@ -243,24 +243,24 @@ describe Ohai::System, "plugin ec2" do
243
243
  end
244
244
 
245
245
  it "parses ec2 iam/ directory and NOT collect iam/security-credentials/" do
246
- expect(@http_client).to receive(:get).
247
- with("/2012-01-12/meta-data/").
248
- and_return(double("Net::HTTP Response", :body => "iam/", :code => "200"))
249
- expect(@http_client).to receive(:get).
250
- with("/2012-01-12/meta-data/iam/").
251
- and_return(double("Net::HTTP Response", :body => "security-credentials/", :code => "200"))
252
- expect(@http_client).to receive(:get).
253
- with("/2012-01-12/meta-data/iam/security-credentials/").
254
- and_return(double("Net::HTTP Response", :body => "MyRole", :code => "200"))
255
- expect(@http_client).to receive(:get).
256
- with("/2012-01-12/meta-data/iam/security-credentials/MyRole").
257
- and_return(double("Net::HTTP Response", :body => "{\n \"Code\" : \"Success\",\n \"LastUpdated\" : \"2012-08-22T07:47:22Z\",\n \"Type\" : \"AWS-HMAC\",\n \"AccessKeyId\" : \"AAAAAAAA\",\n \"SecretAccessKey\" : \"SSSSSSSS\",\n \"Token\" : \"12345678\",\n \"Expiration\" : \"2012-08-22T11:25:52Z\"\n}", :code => "200"))
258
- expect(@http_client).to receive(:get).
259
- with("/2012-01-12/user-data/").
260
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
261
- expect(@http_client).to receive(:get).
262
- with("/2012-01-12/dynamic/instance-identity/document/").
263
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
246
+ expect(@http_client).to receive(:get)
247
+ .with("/2012-01-12/meta-data/")
248
+ .and_return(double("Net::HTTP Response", body: "iam/", code: "200"))
249
+ expect(@http_client).to receive(:get)
250
+ .with("/2012-01-12/meta-data/iam/")
251
+ .and_return(double("Net::HTTP Response", body: "security-credentials/", code: "200"))
252
+ expect(@http_client).to receive(:get)
253
+ .with("/2012-01-12/meta-data/iam/security-credentials/")
254
+ .and_return(double("Net::HTTP Response", body: "MyRole", code: "200"))
255
+ expect(@http_client).to receive(:get)
256
+ .with("/2012-01-12/meta-data/iam/security-credentials/MyRole")
257
+ .and_return(double("Net::HTTP Response", body: "{\n \"Code\" : \"Success\",\n \"LastUpdated\" : \"2012-08-22T07:47:22Z\",\n \"Type\" : \"AWS-HMAC\",\n \"AccessKeyId\" : \"AAAAAAAA\",\n \"SecretAccessKey\" : \"SSSSSSSS\",\n \"Token\" : \"12345678\",\n \"Expiration\" : \"2012-08-22T11:25:52Z\"\n}", code: "200"))
258
+ expect(@http_client).to receive(:get)
259
+ .with("/2012-01-12/user-data/")
260
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
261
+ expect(@http_client).to receive(:get)
262
+ .with("/2012-01-12/dynamic/instance-identity/document/")
263
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
264
264
 
265
265
  plugin.run
266
266
 
@@ -270,39 +270,39 @@ describe Ohai::System, "plugin ec2" do
270
270
  end
271
271
 
272
272
  it "ignores \"./\" and \"../\" on ec2 metadata paths to avoid infinity loops" do
273
- expect(@http_client).to receive(:get).
274
- with("/2012-01-12/meta-data/").
275
- and_return(double("Net::HTTP Response", :body => ".\n./\n..\n../\npath1/.\npath2/./\npath3/..\npath4/../", :code => "200"))
276
-
277
- expect(@http_client).not_to receive(:get).
278
- with("/2012-01-12/meta-data/.")
279
- expect(@http_client).not_to receive(:get).
280
- with("/2012-01-12/meta-data/./")
281
- expect(@http_client).not_to receive(:get).
282
- with("/2012-01-12/meta-data/..")
283
- expect(@http_client).not_to receive(:get).
284
- with("/2012-01-12/meta-data/../")
285
- expect(@http_client).not_to receive(:get).
286
- with("/2012-01-12/meta-data/path1/..")
287
-
288
- expect(@http_client).to receive(:get).
289
- with("/2012-01-12/meta-data/path1/").
290
- and_return(double("Net::HTTP Response", :body => "", :code => "200"))
291
- expect(@http_client).to receive(:get).
292
- with("/2012-01-12/meta-data/path2/").
293
- and_return(double("Net::HTTP Response", :body => "", :code => "200"))
294
- expect(@http_client).to receive(:get).
295
- with("/2012-01-12/meta-data/path3/").
296
- and_return(double("Net::HTTP Response", :body => "", :code => "200"))
297
- expect(@http_client).to receive(:get).
298
- with("/2012-01-12/meta-data/path4/").
299
- and_return(double("Net::HTTP Response", :body => "", :code => "200"))
300
- expect(@http_client).to receive(:get).
301
- with("/2012-01-12/user-data/").
302
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
303
- expect(@http_client).to receive(:get).
304
- with("/2012-01-12/dynamic/instance-identity/document/").
305
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
273
+ expect(@http_client).to receive(:get)
274
+ .with("/2012-01-12/meta-data/")
275
+ .and_return(double("Net::HTTP Response", body: ".\n./\n..\n../\npath1/.\npath2/./\npath3/..\npath4/../", code: "200"))
276
+
277
+ expect(@http_client).not_to receive(:get)
278
+ .with("/2012-01-12/meta-data/.")
279
+ expect(@http_client).not_to receive(:get)
280
+ .with("/2012-01-12/meta-data/./")
281
+ expect(@http_client).not_to receive(:get)
282
+ .with("/2012-01-12/meta-data/..")
283
+ expect(@http_client).not_to receive(:get)
284
+ .with("/2012-01-12/meta-data/../")
285
+ expect(@http_client).not_to receive(:get)
286
+ .with("/2012-01-12/meta-data/path1/..")
287
+
288
+ expect(@http_client).to receive(:get)
289
+ .with("/2012-01-12/meta-data/path1/")
290
+ .and_return(double("Net::HTTP Response", body: "", code: "200"))
291
+ expect(@http_client).to receive(:get)
292
+ .with("/2012-01-12/meta-data/path2/")
293
+ .and_return(double("Net::HTTP Response", body: "", code: "200"))
294
+ expect(@http_client).to receive(:get)
295
+ .with("/2012-01-12/meta-data/path3/")
296
+ .and_return(double("Net::HTTP Response", body: "", code: "200"))
297
+ expect(@http_client).to receive(:get)
298
+ .with("/2012-01-12/meta-data/path4/")
299
+ .and_return(double("Net::HTTP Response", body: "", code: "200"))
300
+ expect(@http_client).to receive(:get)
301
+ .with("/2012-01-12/user-data/")
302
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
303
+ expect(@http_client).to receive(:get)
304
+ .with("/2012-01-12/dynamic/instance-identity/document/")
305
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
306
306
 
307
307
  plugin.run
308
308
 
@@ -310,21 +310,21 @@ describe Ohai::System, "plugin ec2" do
310
310
  end
311
311
 
312
312
  it "completes the run despite unavailable metadata" do
313
- expect(@http_client).to receive(:get).
314
- with("/2012-01-12/meta-data/").
315
- and_return(double("Net::HTTP Response", :body => "metrics/", :code => "200"))
316
- expect(@http_client).to receive(:get).
317
- with("/2012-01-12/meta-data/metrics/").
318
- and_return(double("Net::HTTP Response", :body => "vhostmd", :code => "200"))
319
- expect(@http_client).to receive(:get).
320
- with("/2012-01-12/meta-data/metrics/vhostmd").
321
- and_return(double("Net::HTTP Response", :body => "", :code => "404"))
322
- expect(@http_client).to receive(:get).
323
- with("/2012-01-12/user-data/").
324
- and_return(double("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
325
- expect(@http_client).to receive(:get).
326
- with("/2012-01-12/dynamic/instance-identity/document/").
327
- and_return(double("Net::HTTP Response", :body => "{\"accountId\":\"4815162342\"}", :code => "200"))
313
+ expect(@http_client).to receive(:get)
314
+ .with("/2012-01-12/meta-data/")
315
+ .and_return(double("Net::HTTP Response", body: "metrics/", code: "200"))
316
+ expect(@http_client).to receive(:get)
317
+ .with("/2012-01-12/meta-data/metrics/")
318
+ .and_return(double("Net::HTTP Response", body: "vhostmd", code: "200"))
319
+ expect(@http_client).to receive(:get)
320
+ .with("/2012-01-12/meta-data/metrics/vhostmd")
321
+ .and_return(double("Net::HTTP Response", body: "", code: "404"))
322
+ expect(@http_client).to receive(:get)
323
+ .with("/2012-01-12/user-data/")
324
+ .and_return(double("Net::HTTP Response", body: "By the pricking of my thumb...", code: "200"))
325
+ expect(@http_client).to receive(:get)
326
+ .with("/2012-01-12/dynamic/instance-identity/document/")
327
+ .and_return(double("Net::HTTP Response", body: "{\"accountId\":\"4815162342\"}", code: "200"))
328
328
 
329
329
  plugin.run
330
330