ohai 6.16.0 → 6.18.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ohai/mixin/ec2_metadata.rb +68 -20
- data/lib/ohai/mixin/gce_metadata.rb +101 -0
- data/lib/ohai/plugins/azure.rb +13 -0
- data/lib/ohai/plugins/cloud.rb +66 -0
- data/lib/ohai/plugins/darwin/cpu.rb +23 -0
- data/lib/ohai/plugins/gce.rb +40 -0
- data/lib/ohai/plugins/linux/platform.rb +22 -7
- data/lib/ohai/plugins/network.rb +17 -15
- data/lib/ohai/plugins/rackspace.rb +10 -10
- data/lib/ohai/plugins/root_group.rb +30 -0
- data/lib/ohai/plugins/ssh_host_key.rb +24 -14
- data/lib/ohai/system.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/mixin/ec2_metadata_spec.rb +82 -0
- data/spec/unit/plugins/azure_spec.rb +73 -0
- data/spec/unit/plugins/cloud_spec.rb +48 -0
- data/spec/unit/plugins/darwin/cpu_spec.rb +40 -0
- data/spec/unit/plugins/ec2_spec.rb +27 -24
- data/spec/unit/plugins/eucalyptus_spec.rb +12 -9
- data/spec/unit/plugins/gce_spec.rb +130 -0
- data/spec/unit/plugins/linux/platform_spec.rb +19 -10
- data/spec/unit/plugins/network_spec.rb +39 -17
- data/spec/unit/plugins/rackspace_spec.rb +47 -50
- data/spec/unit/plugins/root_group_spec.rb +131 -0
- data/spec/unit/plugins/ssh_host_keys_spec.rb +37 -8
- data/spec/unit/system_spec.rb +19 -1
- metadata +187 -176
data/lib/ohai/plugins/network.rb
CHANGED
@@ -63,49 +63,51 @@ def sorted_ips(family = "inet")
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def find_ip(family = "inet")
|
66
|
-
|
66
|
+
ips=sorted_ips(family)
|
67
67
|
|
68
68
|
# return if there isn't any #{family} address !
|
69
|
-
return [ nil, nil ] if
|
69
|
+
return [ nil, nil ] if ips.empty?
|
70
70
|
|
71
71
|
# shortcuts to access default #{family} interface and gateway
|
72
72
|
int_attr = FAMILIES[family] +"_interface"
|
73
73
|
gw_attr = FAMILIES[family] + "_gateway"
|
74
74
|
|
75
75
|
# If we have a default interface that has addresses,
|
76
|
-
# populate the short-cut attributes
|
76
|
+
# populate the short-cut attributes ipaddress, ip6address and macaddress
|
77
77
|
if network[int_attr]
|
78
78
|
|
79
|
-
#
|
80
|
-
|
79
|
+
# working with the address(es) of the default network interface
|
80
|
+
gw_if_ips = ips.select do |v|
|
81
81
|
v[:iface] == network[int_attr]
|
82
82
|
end
|
83
|
-
if
|
84
|
-
Ohai::Log.warn("[#{family}] no ip on #{network[int_attr]}")
|
83
|
+
if gw_if_ips.empty?
|
84
|
+
Ohai::Log.warn("[#{family}] no ip address on #{network[int_attr]}")
|
85
85
|
elsif network[gw_attr] and
|
86
86
|
network["interfaces"][network[int_attr]] and
|
87
87
|
network["interfaces"][network[int_attr]]["addresses"]
|
88
88
|
if [ "0.0.0.0", "::" ].include? network[gw_attr]
|
89
89
|
# link level default route
|
90
90
|
Ohai::Log.debug("link level default #{family} route, picking ip from #{network[gw_attr]}")
|
91
|
-
r =
|
91
|
+
r = gw_if_ips.first
|
92
92
|
else
|
93
|
-
|
93
|
+
# checking network masks
|
94
|
+
r = gw_if_ips.select do |v|
|
94
95
|
network_contains_address(network[gw_attr], v[:ipaddress], v[:iface])
|
95
96
|
end.first
|
96
97
|
if r.nil?
|
97
|
-
|
98
|
+
r = gw_if_ips.first
|
99
|
+
Ohai::Log.warn("[#{family}] no ipaddress/mask on #{network[int_attr]} matching the gateway #{network[gw_attr]}, picking one anyway")
|
98
100
|
else
|
99
101
|
Ohai::Log.debug("[#{family}] Using default interface #{network[int_attr]} and default gateway #{network[gw_attr]} to set the default ip to #{r[:ipaddress]}")
|
100
102
|
end
|
101
103
|
end
|
102
104
|
else
|
103
105
|
# return the first ip address on network[int_attr]
|
104
|
-
r =
|
106
|
+
r = gw_if_ips.first
|
105
107
|
end
|
106
108
|
else
|
107
|
-
r =
|
108
|
-
Ohai::Log.
|
109
|
+
r = ips.first
|
110
|
+
Ohai::Log.debug("[#{family}] no default interface, picking the first ipaddress")
|
109
111
|
end
|
110
112
|
|
111
113
|
return [ nil, nil ] if r.nil? or r.empty?
|
@@ -159,7 +161,7 @@ FAMILIES.keys.sort.each do |family|
|
|
159
161
|
else
|
160
162
|
ip6address r["ip"]
|
161
163
|
if r["mac"] and macaddress.nil? and ipaddress.nil?
|
162
|
-
Ohai::Log.
|
164
|
+
Ohai::Log.debug("macaddress set to #{r["mac"]} from the ipv6 setup")
|
163
165
|
macaddress r["mac"]
|
164
166
|
end
|
165
167
|
end
|
@@ -169,5 +171,5 @@ end
|
|
169
171
|
|
170
172
|
if results["inet"]["iface"] and results["inet6"]["iface"] and
|
171
173
|
results["inet"]["iface"] != results["inet6"]["iface"]
|
172
|
-
Ohai::Log.
|
174
|
+
Ohai::Log.debug("ipaddress and ip6address are set from different interfaces (#{results["inet"]["iface"]} & #{results["inet6"]["iface"]}), macaddress has been set using the ipaddress interface")
|
173
175
|
end
|
@@ -28,17 +28,17 @@ def has_rackspace_kernel?
|
|
28
28
|
kernel[:release].split('-').last.eql?("rscloud")
|
29
29
|
end
|
30
30
|
|
31
|
-
# Checks for
|
31
|
+
# Checks for rackspace provider attribute
|
32
32
|
#
|
33
33
|
# === Return
|
34
|
-
# true:: If
|
34
|
+
# true:: If rackspace provider attribute found
|
35
35
|
# false:: Otherwise
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
36
|
+
def has_rackspace_metadata?
|
37
|
+
status, stdout, stderr = run_command(:no_status_check => true, :command => "xenstore-read vm-data/provider_data/provider")
|
38
|
+
if status == 0
|
39
|
+
stdout.strip.downcase == 'rackspace'
|
41
40
|
end
|
41
|
+
rescue Ohai::Exceptions::Exec
|
42
42
|
false
|
43
43
|
end
|
44
44
|
|
@@ -48,7 +48,7 @@ end
|
|
48
48
|
# true:: If the rackspace cloud can be identified
|
49
49
|
# false:: Otherwise
|
50
50
|
def looks_like_rackspace?
|
51
|
-
hint?('rackspace') ||
|
51
|
+
hint?('rackspace') || has_rackspace_metadata? || has_rackspace_kernel?
|
52
52
|
end
|
53
53
|
|
54
54
|
# Names rackspace ip address
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
def get_ip_address(name, eth)
|
60
60
|
network[:interfaces][eth][:addresses].each do |key, info|
|
61
61
|
if info['family'] == 'inet'
|
62
|
-
rackspace[name] = key
|
62
|
+
rackspace[name] = key
|
63
63
|
break # break when we found an address
|
64
64
|
end
|
65
65
|
end
|
@@ -74,7 +74,7 @@ def get_global_ipv6_address(name, eth)
|
|
74
74
|
network[:interfaces][eth][:addresses].each do |key, info|
|
75
75
|
# check if we got an ipv6 address and if its in global scope
|
76
76
|
if info['family'] == 'inet6' && info['scope'] == 'Global'
|
77
|
-
rackspace[name] = key
|
77
|
+
rackspace[name] = key
|
78
78
|
break # break when we found an address
|
79
79
|
end
|
80
80
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Joseph Anthony Pasquale Holsten (<joseph@josephholsten.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013 Joseph Anthony Pasquale Holsten
|
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
|
+
provides 'root_group'
|
19
|
+
|
20
|
+
case ::RbConfig::CONFIG['host_os']
|
21
|
+
when /mswin|mingw32|windows/
|
22
|
+
# Per http://support.microsoft.com/kb/243330 SID: S-1-5-32-544 is the
|
23
|
+
# internal name for the Administrators group, which lets us work
|
24
|
+
# properly in environments with a renamed or localized name for the
|
25
|
+
# Administrators group
|
26
|
+
group = WMI::Win32_Group.find(:first, :conditions => {:SID => 'S-1-5-32-544'})
|
27
|
+
root_group group['Name']
|
28
|
+
else
|
29
|
+
root_group Etc.getgrgid(Etc.getpwnam('root').gid).name
|
30
|
+
end
|
@@ -21,14 +21,16 @@ require_plugin "keys"
|
|
21
21
|
|
22
22
|
keys[:ssh] = Mash.new
|
23
23
|
|
24
|
-
def
|
25
|
-
case
|
24
|
+
def extract_keytype?(content)
|
25
|
+
case content[0]
|
26
26
|
when "ssh-dss"
|
27
|
-
"dsa"
|
27
|
+
[ "dsa", nil ]
|
28
28
|
when "ssh-rsa"
|
29
|
-
"rsa"
|
29
|
+
[ "rsa", nil ]
|
30
|
+
when /^ecdsa/
|
31
|
+
[ "ecdsa", content[0] ]
|
30
32
|
else
|
31
|
-
nil
|
33
|
+
[ nil, nil ]
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
@@ -47,17 +49,25 @@ if sshd_config
|
|
47
49
|
conf.each_line do |line|
|
48
50
|
if line.match(/^hostkey\s/i)
|
49
51
|
pub_file = "#{line.split[1]}.pub"
|
50
|
-
|
51
|
-
|
52
|
+
content = IO.read(pub_file).split
|
53
|
+
key_type, key_subtype = extract_keytype?(content)
|
54
|
+
keys[:ssh]["host_#{key_type}_public"] = content[1] unless key_type.nil?
|
55
|
+
keys[:ssh]["host_#{key_type}_type"] = key_subtype unless key_subtype.nil?
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
55
|
-
|
56
|
-
if keys[:ssh][:host_dsa_public].nil? && File.exists?("/etc/ssh/ssh_host_dsa_key.pub")
|
57
|
-
keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
|
58
|
-
end
|
59
|
+
end
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
if keys[:ssh][:host_dsa_public].nil? && File.exists?("/etc/ssh/ssh_host_dsa_key.pub")
|
62
|
+
keys[:ssh][:host_dsa_public] = IO.read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
|
63
|
+
end
|
64
|
+
|
65
|
+
if keys[:ssh][:host_rsa_public].nil? && File.exists?("/etc/ssh/ssh_host_rsa_key.pub")
|
66
|
+
keys[:ssh][:host_rsa_public] = IO.read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
|
67
|
+
end
|
68
|
+
|
69
|
+
if keys[:ssh][:host_ecdsa_public].nil? && File.exists?("/etc/ssh/ssh_host_ecdsa_key.pub")
|
70
|
+
content = IO.read("/etc/ssh/ssh_host_ecdsa_key.pub")
|
71
|
+
keys[:ssh][:host_ecdsa_public] = content.split[1]
|
72
|
+
keys[:ssh][:host_ecdsa_type] = content.split[0]
|
63
73
|
end
|
data/lib/ohai/system.rb
CHANGED
@@ -133,7 +133,7 @@ module Ohai
|
|
133
133
|
Dir[File.join(path, '*')],
|
134
134
|
Dir[File.join(path, @data[:os], '**', '*')]
|
135
135
|
].flatten.each do |file|
|
136
|
-
file_regex = Regexp.new("#{path}#{File::SEPARATOR}(.+).rb$")
|
136
|
+
file_regex = Regexp.new("#{File.expand_path(path)}#{File::SEPARATOR}(.+).rb$")
|
137
137
|
md = file_regex.match(file)
|
138
138
|
if md
|
139
139
|
plugin_name = md[1].gsub(File::SEPARATOR, "::")
|
data/lib/ohai/version.rb
CHANGED
@@ -0,0 +1,82 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
+
# Copyright:: Copyright (c) 2013 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 CONDIT"Net::HTTP Response"NS 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
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
20
|
+
require 'ohai/mixin/ec2_metadata'
|
21
|
+
|
22
|
+
describe Ohai::Mixin::Ec2Metadata do
|
23
|
+
let(:mixin) {
|
24
|
+
metadata_object = Object.new.extend(Ohai::Mixin::Ec2Metadata)
|
25
|
+
http_client = mock("Net::HTTP client")
|
26
|
+
http_client.stub!(:get).and_return(response)
|
27
|
+
metadata_object.stub!(:http_client).and_return(http_client)
|
28
|
+
metadata_object
|
29
|
+
}
|
30
|
+
|
31
|
+
context "#best_api_version" do
|
32
|
+
context "with a sorted list of metadata versions" do
|
33
|
+
let(:response) { mock("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "200") }
|
34
|
+
|
35
|
+
it "returns the most recent version" do
|
36
|
+
mixin.best_api_version.should == "2012-01-12"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "with an unsorted list of metadata versions" do
|
41
|
+
let(:response) { mock("Net::HTTP Response", :body => "1.0\n2009-04-04\n2007-03-01\n2011-05-01\n2008-09-01\nUnsupported", :code => "200") }
|
42
|
+
|
43
|
+
it "returns the most recent version (using string sort)" do
|
44
|
+
mixin.best_api_version.should == "2011-05-01"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when no supported versions are found" do
|
49
|
+
let(:response) { mock("Net::HTTP Response", :body => "2020-01-01\nUnsupported", :code => "200") }
|
50
|
+
|
51
|
+
it "raises an error" do
|
52
|
+
lambda { mixin.best_api_version}.should raise_error
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when the response code is 404" do
|
57
|
+
let(:response) { mock("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "404") }
|
58
|
+
|
59
|
+
it "raises an error" do
|
60
|
+
lambda { mixin.best_api_version}.should raise_error
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when the response code is unexpected" do
|
65
|
+
let(:response) { mock("Net::HTTP Response", :body => "1.0\n2011-05-01\n2012-01-12\nUnsupported", :code => "418") }
|
66
|
+
|
67
|
+
it "raises an error" do
|
68
|
+
lambda { mixin.best_api_version}.should raise_error
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "#metadata_get" do
|
74
|
+
context "when the response code is unexpected" do
|
75
|
+
let(:response) { mock("Net::HTTP Response", :body => "", :code => "418") }
|
76
|
+
|
77
|
+
it "raises an error" do
|
78
|
+
lambda { mixin.metadata_get('', '2012-01-12') }.should raise_error(RuntimeError)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011-2013 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
|
+
|
20
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
21
|
+
require 'open-uri'
|
22
|
+
|
23
|
+
describe Ohai::System, "plugin azure" do
|
24
|
+
before(:each) do
|
25
|
+
@ohai = Ohai::System.new
|
26
|
+
@ohai.stub!(:require_plugin).and_return(true)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "with azure cloud file" do
|
30
|
+
before(:each) do
|
31
|
+
File.stub!(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(true)
|
32
|
+
File.stub!(:read).with('/etc/chef/ohai/hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
|
33
|
+
File.stub!(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(true)
|
34
|
+
File.stub!(:read).with('C:\chef\ohai\hints/azure.json').and_return('{"public_ip":"137.135.46.202","vm_name":"test-vm","public_fqdn":"service.cloudapp.net","public_ssh_port":"22", "public_winrm_port":"5985"}')
|
35
|
+
@ohai._require_plugin("azure")
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should set the azure cloud attributes' do
|
39
|
+
@ohai[:azure].should_not be_nil
|
40
|
+
@ohai[:azure]['public_ip'].should == "137.135.46.202"
|
41
|
+
@ohai[:azure]['vm_name'].should == "test-vm"
|
42
|
+
@ohai[:azure]['public_fqdn'].should == "service.cloudapp.net"
|
43
|
+
@ohai[:azure]['public_ssh_port'].should == "22"
|
44
|
+
@ohai[:azure]['public_winrm_port'].should == "5985"
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "without azure cloud file" do
|
50
|
+
before(:each) do
|
51
|
+
File.stub!(:exist?).with('/etc/chef/ohai/hints/azure.json').and_return(false)
|
52
|
+
File.stub!(:exist?).with('C:\chef\ohai\hints/azure.json').and_return(false)
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should not behave like azure' do
|
56
|
+
@ohai[:azure].should be_nil
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "with rackspace cloud file" do
|
61
|
+
before(:each) do
|
62
|
+
File.stub!(:exist?).with('/etc/chef/ohai/hints/rackspace.json').and_return(true)
|
63
|
+
File.stub!(:read).with('/etc/chef/ohai/hints/rackspace.json').and_return('')
|
64
|
+
File.stub!(:exist?).with('C:\chef\ohai\hints/rackspace.json').and_return(true)
|
65
|
+
File.stub!(:read).with('C:\chef\ohai\hints/rackspace.json').and_return('')
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should not behave like azure' do
|
69
|
+
@ohai[:azure].should be_nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -29,6 +29,7 @@ describe Ohai::System, "plugin cloud" do
|
|
29
29
|
@ohai[:rackspace] = nil
|
30
30
|
@ohai[:eucalyptus] = nil
|
31
31
|
@ohai[:linode] = nil
|
32
|
+
@ohai[:azure] = nil
|
32
33
|
@ohai._require_plugin("cloud")
|
33
34
|
@ohai[:cloud].should be_nil
|
34
35
|
end
|
@@ -156,4 +157,51 @@ describe Ohai::System, "plugin cloud" do
|
|
156
157
|
end
|
157
158
|
end
|
158
159
|
|
160
|
+
describe "with Azure mash" do
|
161
|
+
before do
|
162
|
+
@ohai[:azure] = Mash.new()
|
163
|
+
end
|
164
|
+
|
165
|
+
it "populates cloud public ip" do
|
166
|
+
@ohai[:azure]['public_ip'] = "174.129.150.8"
|
167
|
+
@ohai._require_plugin("cloud")
|
168
|
+
@ohai[:cloud][:public_ips][0].should == @ohai[:azure]['public_ip']
|
169
|
+
end
|
170
|
+
|
171
|
+
it "populates cloud vm_name" do
|
172
|
+
@ohai[:azure]['vm_name'] = "linux-vm"
|
173
|
+
@ohai._require_plugin("cloud")
|
174
|
+
@ohai[:cloud][:vm_name].should == @ohai[:azure]['vm_name']
|
175
|
+
end
|
176
|
+
|
177
|
+
it "populates cloud public_fqdn" do
|
178
|
+
@ohai[:azure]['public_fqdn'] = "linux-vm-svc.cloudapp.net"
|
179
|
+
@ohai._require_plugin("cloud")
|
180
|
+
@ohai[:cloud][:public_fqdn].should == @ohai[:azure]['public_fqdn']
|
181
|
+
end
|
182
|
+
|
183
|
+
it "populates cloud public_ssh_port" do
|
184
|
+
@ohai[:azure]['public_ssh_port'] = "22"
|
185
|
+
@ohai._require_plugin("cloud")
|
186
|
+
@ohai[:cloud][:public_ssh_port].should == @ohai[:azure]['public_ssh_port']
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should not populate cloud public_ssh_port when winrm is used" do
|
190
|
+
@ohai[:azure]['public_winrm_port'] = "5985"
|
191
|
+
@ohai._require_plugin("cloud")
|
192
|
+
@ohai[:cloud][:public_ssh_port].should be_nil
|
193
|
+
end
|
194
|
+
|
195
|
+
it "populates cloud public_winrm_port" do
|
196
|
+
@ohai[:azure]['public_winrm_port'] = "5985"
|
197
|
+
@ohai._require_plugin("cloud")
|
198
|
+
@ohai[:cloud][:public_winrm_port].should == @ohai[:azure]['public_winrm_port']
|
199
|
+
end
|
200
|
+
|
201
|
+
it "populates cloud provider" do
|
202
|
+
@ohai._require_plugin("cloud")
|
203
|
+
@ohai[:cloud][:provider].should == "azure"
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
159
207
|
end
|