ohai 6.14.0 → 6.16.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/lib/ohai/mixin/ec2_metadata.rb +61 -6
  2. data/lib/ohai/plugins/cloud.rb +69 -5
  3. data/lib/ohai/plugins/darwin/system_profiler.rb +44 -7
  4. data/lib/ohai/plugins/freebsd/virtualization.rb +16 -0
  5. data/lib/ohai/plugins/java.rb +1 -1
  6. data/lib/ohai/plugins/kernel.rb +1 -0
  7. data/lib/ohai/plugins/linode.rb +53 -0
  8. data/lib/ohai/plugins/linux/platform.rb +6 -2
  9. data/lib/ohai/plugins/network.rb +130 -44
  10. data/lib/ohai/plugins/{aix/ssh_host_key.rb → nodejs.rb} +15 -7
  11. data/lib/ohai/plugins/openstack.rb +46 -0
  12. data/lib/ohai/plugins/rackspace.rb +35 -1
  13. data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
  14. data/lib/ohai/plugins/solaris2/network.rb +2 -1
  15. data/lib/ohai/plugins/solaris2/platform.rb +2 -2
  16. data/lib/ohai/plugins/ssh_host_key.rb +63 -0
  17. data/lib/ohai/plugins/virtualization.rb +1 -1
  18. data/lib/ohai/plugins/windows/cpu.rb +20 -3
  19. data/lib/ohai/plugins/windows/kernel.rb +0 -19
  20. data/lib/ohai/plugins/windows/kernel_devices.rb +39 -0
  21. data/lib/ohai/system.rb +3 -2
  22. data/lib/ohai/version.rb +1 -1
  23. data/spec/spec_helper.rb +14 -1
  24. data/spec/support/platform_helpers.rb +31 -0
  25. data/spec/{ohai → unit}/mixin/command_spec.rb +0 -0
  26. data/spec/{ohai → unit}/mixin/from_file_spec.rb +0 -0
  27. data/spec/{ohai → unit}/plugins/c_spec.rb +0 -0
  28. data/spec/{ohai → unit}/plugins/chef_spec.rb +20 -12
  29. data/spec/unit/plugins/cloud_spec.rb +159 -0
  30. data/spec/{ohai → unit}/plugins/darwin/hostname_spec.rb +0 -0
  31. data/spec/{ohai → unit}/plugins/darwin/kernel_spec.rb +0 -0
  32. data/spec/{ohai → unit}/plugins/darwin/network_spec.rb +4 -2
  33. data/spec/{ohai → unit}/plugins/darwin/platform_spec.rb +0 -0
  34. data/spec/unit/plugins/darwin/system_profiler_output.rb +79525 -0
  35. data/spec/unit/plugins/darwin/system_profiler_spec.rb +48 -0
  36. data/spec/{ohai → unit}/plugins/dmi_spec.rb +0 -0
  37. data/spec/unit/plugins/ec2_spec.rb +199 -0
  38. data/spec/{ohai → unit}/plugins/erlang_spec.rb +0 -0
  39. data/spec/{ohai → unit}/plugins/eucalyptus_spec.rb +5 -5
  40. data/spec/{ohai → unit}/plugins/fail_spec.rb +0 -0
  41. data/spec/{ohai → unit}/plugins/freebsd/hostname_spec.rb +0 -0
  42. data/spec/{ohai → unit}/plugins/freebsd/kernel_spec.rb +0 -0
  43. data/spec/{ohai → unit}/plugins/freebsd/platform_spec.rb +0 -0
  44. data/spec/unit/plugins/freebsd/virtualization_spec.rb +99 -0
  45. data/spec/{ohai → unit}/plugins/groovy_spec.rb +0 -0
  46. data/spec/{ohai → unit}/plugins/hostname_spec.rb +0 -0
  47. data/spec/{ohai → unit}/plugins/java_spec.rb +0 -0
  48. data/spec/{ohai → unit}/plugins/kernel_spec.rb +0 -0
  49. data/spec/unit/plugins/linode_spec.rb +156 -0
  50. data/spec/{ohai → unit}/plugins/linux/cpu_spec.rb +0 -0
  51. data/spec/{ohai → unit}/plugins/linux/filesystem_spec.rb +0 -0
  52. data/spec/{ohai → unit}/plugins/linux/hostname_spec.rb +0 -0
  53. data/spec/{ohai → unit}/plugins/linux/kernel_spec.rb +0 -0
  54. data/spec/{ohai → unit}/plugins/linux/lsb_spec.rb +0 -0
  55. data/spec/{ohai → unit}/plugins/linux/network_spec.rb +3 -60
  56. data/spec/{ohai → unit}/plugins/linux/platform_spec.rb +10 -0
  57. data/spec/{ohai → unit}/plugins/linux/uptime_spec.rb +0 -0
  58. data/spec/{ohai → unit}/plugins/linux/virtualization_spec.rb +0 -0
  59. data/spec/{ohai → unit}/plugins/lua_spec.rb +0 -0
  60. data/spec/{ohai → unit}/plugins/mono_spec.rb +0 -0
  61. data/spec/{ohai → unit}/plugins/netbsd/hostname_spec.rb +0 -0
  62. data/spec/{ohai → unit}/plugins/netbsd/kernel_spec.rb +0 -0
  63. data/spec/{ohai → unit}/plugins/netbsd/platform_spec.rb +0 -0
  64. data/spec/unit/plugins/network_spec.rb +829 -0
  65. data/spec/unit/plugins/nodejs_spec.rb +51 -0
  66. data/spec/{ohai → unit}/plugins/ohai_spec.rb +0 -0
  67. data/spec/{ohai → unit}/plugins/ohai_time_spec.rb +0 -0
  68. data/spec/{ohai → unit}/plugins/openbsd/hostname_spec.rb +0 -0
  69. data/spec/{ohai → unit}/plugins/openbsd/kernel_spec.rb +0 -0
  70. data/spec/{ohai → unit}/plugins/openbsd/platform_spec.rb +0 -0
  71. data/spec/{ohai → unit}/plugins/os_spec.rb +0 -0
  72. data/spec/{ohai → unit}/plugins/passwd_spec.rb +0 -0
  73. data/spec/{ohai → unit}/plugins/perl_spec.rb +0 -0
  74. data/spec/{ohai → unit}/plugins/php_spec.rb +0 -0
  75. data/spec/{ohai → unit}/plugins/platform_spec.rb +0 -0
  76. data/spec/{ohai → unit}/plugins/python_spec.rb +0 -0
  77. data/spec/{ohai → unit}/plugins/rackspace_spec.rb +26 -0
  78. data/spec/{ohai → unit}/plugins/ruby_spec.rb +0 -0
  79. data/spec/{ohai → unit}/plugins/sigar/network_route_spec.rb +1 -0
  80. data/spec/{ohai → unit}/plugins/solaris2/hostname_spec.rb +0 -0
  81. data/spec/{ohai → unit}/plugins/solaris2/kernel_spec.rb +0 -0
  82. data/spec/{ohai → unit}/plugins/solaris2/network_spec.rb +8 -1
  83. data/spec/{ohai → unit}/plugins/solaris2/platform_spec.rb +0 -0
  84. data/spec/{ohai → unit}/plugins/solaris2/virtualization_spec.rb +0 -0
  85. data/spec/unit/plugins/ssh_host_keys_spec.rb +77 -0
  86. data/spec/{ohai → unit}/system_spec.rb +0 -0
  87. metadata +221 -184
  88. data/lib/ohai/plugins/darwin/ssh_host_key.rb +0 -25
  89. data/lib/ohai/plugins/freebsd/ssh_host_key.rb +0 -26
  90. data/lib/ohai/plugins/hpux/ssh_host_key.rb +0 -26
  91. data/lib/ohai/plugins/linux/ssh_host_key.rb +0 -26
  92. data/lib/ohai/plugins/netbsd/ssh_host_key.rb +0 -26
  93. data/lib/ohai/plugins/openbsd/ssh_host_key.rb +0 -26
  94. data/lib/ohai/plugins/solaris2/ssh_host_key.rb +0 -26
  95. data/spec/ohai/plugins/cloud_spec.rb +0 -113
  96. data/spec/ohai/plugins/ec2_spec.rb +0 -120
@@ -1,25 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh_host_dsa_key.pub").split[1]
25
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/opt/ssh/etc/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/opt/ssh/etc/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -1,26 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- provides "keys/ssh"
20
-
21
- require_plugin "keys"
22
-
23
- keys[:ssh] = Mash.new
24
-
25
- keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
26
- keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
@@ -1,113 +0,0 @@
1
- #
2
- # Author:: Cary Penniman (<cary@rightscale.com>)
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
19
-
20
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
-
22
- describe Ohai::System, "plugin cloud" do
23
- before(:each) do
24
- @ohai = Ohai::System.new
25
- @ohai.stub!(:require_plugin).and_return(true)
26
- end
27
-
28
- describe "no cloud" do
29
- it "should NOT populate the cloud data" do
30
- @ohai[:ec2] = nil
31
- @ohai[:rackspace] = nil
32
- @ohai[:eucalyptus] = nil
33
- @ohai._require_plugin("cloud")
34
- @ohai[:cloud].should be_nil
35
- end
36
- end
37
-
38
- describe "with EC2" do
39
- before(:each) do
40
- @ohai[:ec2] = Mash.new()
41
- end
42
-
43
- it "should populate cloud public ip" do
44
- @ohai[:ec2]['public_ipv4'] = "174.129.150.8"
45
- @ohai._require_plugin("cloud")
46
- @ohai[:cloud][:public_ips][0].should == @ohai[:ec2]['public_ipv4']
47
- end
48
-
49
- it "should populate cloud private ip" do
50
- @ohai[:ec2]['local_ipv4'] = "10.252.42.149"
51
- @ohai._require_plugin("cloud")
52
- @ohai[:cloud][:private_ips][0].should == @ohai[:ec2]['local_ipv4']
53
- end
54
-
55
- it "should populate cloud provider" do
56
- @ohai._require_plugin("cloud")
57
- @ohai[:cloud][:provider].should == "ec2"
58
- end
59
- end
60
-
61
- describe "with rackspace" do
62
- before(:each) do
63
- @ohai[:rackspace] = Mash.new()
64
- end
65
-
66
- it "should populate cloud public ip" do
67
- @ohai[:rackspace]['public_ip'] = "174.129.150.8"
68
- @ohai._require_plugin("cloud")
69
- @ohai[:cloud][:public_ips][0].should == @ohai[:rackspace][:public_ip]
70
- end
71
-
72
- it "should populate cloud private ip" do
73
- @ohai[:rackspace]['private_ip'] = "10.252.42.149"
74
- @ohai._require_plugin("cloud")
75
- @ohai[:cloud][:private_ips][0].should == @ohai[:rackspace][:private_ip]
76
- end
77
-
78
- it "should populate first cloud public ip" do
79
- @ohai[:rackspace]['public_ip'] = "174.129.150.8"
80
- @ohai._require_plugin("cloud")
81
- @ohai[:cloud][:public_ips].first.should == @ohai[:rackspace][:public_ip]
82
- end
83
-
84
- it "should populate cloud provider" do
85
- @ohai._require_plugin("cloud")
86
- @ohai[:cloud][:provider].should == "rackspace"
87
- end
88
- end
89
-
90
- describe "with eucalyptus" do
91
- before(:each) do
92
- @ohai[:eucalyptus] = Mash.new()
93
- end
94
-
95
- it "should populate cloud public ip" do
96
- @ohai[:eucalyptus]['public_ipv4'] = "174.129.150.8"
97
- @ohai._require_plugin("cloud")
98
- @ohai[:cloud][:public_ips][0].should == @ohai[:eucalyptus]['public_ipv4']
99
- end
100
-
101
- it "should populate cloud private ip" do
102
- @ohai[:eucalyptus]['local_ipv4'] = "10.252.42.149"
103
- @ohai._require_plugin("cloud")
104
- @ohai[:cloud][:private_ips][0].should == @ohai[:eucalyptus]['local_ipv4']
105
- end
106
-
107
- it "should populate cloud provider" do
108
- @ohai._require_plugin("cloud")
109
- @ohai[:cloud][:provider].should == "eucalyptus"
110
- end
111
- end
112
-
113
- end
@@ -1,120 +0,0 @@
1
- #
2
- # Author:: Tim Dysinger (<tim@dysinger.net>)
3
- # Author:: Christopher Brown (cb@opscode.com)
4
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDIT"Net::HTTP Response"NS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
21
- require 'open-uri'
22
-
23
- describe Ohai::System, "plugin ec2" do
24
- before(:each) do
25
- @ohai = Ohai::System.new
26
- @ohai.stub!(:require_plugin).and_return(true)
27
- @ohai[:network] = {:interfaces => {:eth0 => {} } }
28
- end
29
-
30
- shared_examples_for "!ec2" do
31
- it "should NOT attempt to fetch the ec2 metadata" do
32
- @ohai.should_not_receive(:http_client)
33
- @ohai._require_plugin("ec2")
34
- end
35
- end
36
-
37
- shared_examples_for "ec2" do
38
- before(:each) do
39
- @http_client = mock("Net::HTTP client")
40
- @ohai.stub!(:http_client).and_return(@http_client)
41
-
42
- @http_client.should_receive(:get).
43
- with("/2008-02-01/meta-data/").
44
- and_return(mock("Net::HTTP Response", :body => "instance_type\nami_id\nsecurity-groups"))
45
- @http_client.should_receive(:get).
46
- with("/2008-02-01/meta-data/instance_type").
47
- and_return(mock("Net::HTTP Response", :body => "c1.medium"))
48
- @http_client.should_receive(:get).
49
- with("/2008-02-01/meta-data/ami_id").
50
- and_return(mock("Net::HTTP Response", :body => "ami-5d2dc934"))
51
- @http_client.should_receive(:get).
52
- with("/2008-02-01/meta-data/security-groups").
53
- and_return(mock("Net::HTTP Response", :body => "group1\ngroup2"))
54
- @http_client.should_receive(:get).
55
- with("/2008-02-01/user-data/").
56
- and_return(mock("Net::HTTP Response", :body => "By the pricking of my thumb...", :code => "200"))
57
- end
58
-
59
- it "should recursively fetch all the ec2 metadata" do
60
- IO.stub!(:select).and_return([[],[1],[]])
61
- t = mock("connection")
62
- t.stub!(:connect_nonblock).and_raise(Errno::EINPROGRESS)
63
- Socket.stub!(:new).and_return(t)
64
- @ohai._require_plugin("ec2")
65
- @ohai[:ec2].should_not be_nil
66
- @ohai[:ec2]['instance_type'].should == "c1.medium"
67
- @ohai[:ec2]['ami_id'].should == "ami-5d2dc934"
68
- @ohai[:ec2]['security_groups'].should eql ['group1', 'group2']
69
- end
70
- end
71
-
72
- describe "with ec2 mac and metadata address connected" do
73
- it_should_behave_like "ec2"
74
-
75
- before(:each) do
76
- IO.stub!(:select).and_return([[],[1],[]])
77
- @ohai[:network][:interfaces][:eth0][:arp] = {"169.254.1.0"=>"fe:ff:ff:ff:ff:ff"}
78
- end
79
- end
80
-
81
- describe "without ec2 mac and metadata address connected" do
82
- it_should_behave_like "!ec2"
83
-
84
- before(:each) do
85
- @ohai[:network][:interfaces][:eth0][:arp] = {"169.254.1.0"=>"00:50:56:c0:00:08"}
86
- end
87
- end
88
-
89
- describe "with ec2 cloud file" do
90
- it_should_behave_like "ec2"
91
-
92
- before(:each) do
93
- File.stub!(:exist?).with('/etc/chef/ohai/hints/ec2.json').and_return(true)
94
- File.stub!(:read).with('/etc/chef/ohai/hints/ec2.json').and_return('')
95
- File.stub!(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(true)
96
- File.stub!(:read).with('C:\chef\ohai\hints/ec2.json').and_return('')
97
- end
98
- end
99
-
100
- describe "without cloud file" do
101
- it_should_behave_like "!ec2"
102
-
103
- before(:each) do
104
- File.stub!(:exist?).with('/etc/chef/ohai/hints/ec2.json').and_return(false)
105
- File.stub!(:exist?).with('C:\chef\ohai\hints/ec2.json').and_return(false)
106
- end
107
- end
108
-
109
- describe "with rackspace cloud file" do
110
- it_should_behave_like "!ec2"
111
-
112
- before(:each) do
113
- File.stub!(:exist?).with('/etc/chef/ohai/hints/rackspace.json').and_return(true)
114
- File.stub!(:read).with('/etc/chef/ohai/hints/rackspace.json').and_return('')
115
- File.stub!(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
116
- File.stub!(:read).with('C:\chef\ohai\hints/rackspace.json').and_return('')
117
- end
118
- end
119
-
120
- end