cloud.rb

Path: lib/ohai/plugins/cloud.rb
Last Update: Thu Jan 17 19:03:16 +0000 2013
dot/f_0.png
Author:Cary Penniman (<cary@rightscale.com>)
License:Apache License, Version 2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Methods

Public Instance methods

Make top-level cloud hashes

[Source]

    # File lib/ohai/plugins/cloud.rb, line 27
27: def create_objects
28:   cloud Mash.new
29:   cloud[:public_ips] = Array.new
30:   cloud[:private_ips] = Array.new
31: end

Fill cloud hash with ec2 values

[Source]

    # File lib/ohai/plugins/cloud.rb, line 47
47: def get_ec2_values
48:   cloud[:public_ips] << ec2['public_ipv4']
49:   cloud[:private_ips] << ec2['local_ipv4']
50:   cloud[:public_ipv4] = ec2['public_ipv4']
51:   cloud[:public_hostname] = ec2['public_hostname']
52:   cloud[:local_ipv4] = ec2['local_ipv4']
53:   cloud[:local_hostname] = ec2['local_hostname']
54:   cloud[:provider] = "ec2"
55: end

[Source]

     # File lib/ohai/plugins/cloud.rb, line 138
138: def get_eucalyptus_values
139:   cloud[:public_ips] << eucalyptus['public_ipv4']
140:   cloud[:private_ips] << eucalyptus['local_ipv4']
141:   cloud[:public_ipv4] = eucalyptus['public_ipv4']
142:   cloud[:public_hostname] = eucalyptus['public_hostname']
143:   cloud[:local_ipv4] = eucalyptus['local_ipv4']
144:   cloud[:local_hostname] = eucalyptus['local_hostname']
145:   cloud[:provider] = "eucalyptus"
146: end

Fill cloud hash with linode values

[Source]

     # File lib/ohai/plugins/cloud.rb, line 109
109: def get_linode_values
110:   cloud[:public_ips] << linode['public_ip']
111:   cloud[:private_ips] << linode['private_ip']
112:   cloud[:public_ipv4] = linode['public_ipv4']
113:   cloud[:public_hostname] = linode['public_hostname']
114:   cloud[:local_ipv4] = linode['local_ipv4']
115:   cloud[:local_hostname] = linode['local_hostname']
116:   cloud[:provider] = "linode"
117: end

Fill cloud hash with openstack values

[Source]

     # File lib/ohai/plugins/cloud.rb, line 167
167: def get_openstack_values
168:   cloud[:public_ips] << openstack['public_ipv4']
169:   cloud[:private_ips] << openstack['local_ipv4']
170:   cloud[:public_ipv4] = openstack['public_ipv4']
171:   cloud[:public_hostname] = openstack['public_hostname']
172:   cloud[:local_ipv4] = openstack['local_ipv4']
173:   cloud[:local_hostname] = openstack['local_hostname']
174:   cloud[:provider] = openstack['provider']
175: end

Fill cloud hash with rackspace values

[Source]

    # File lib/ohai/plugins/cloud.rb, line 77
77: def get_rackspace_values 
78:   cloud[:public_ips] << rackspace['public_ipv4'] if rackspace['public_ipv4']
79:   cloud[:private_ips] << rackspace['local_ipv4'] if rackspace['local_ipv4']
80:   cloud[:public_ipv4] = rackspace['public_ipv4']
81:   cloud[:public_ipv6] = rackspace['public_ipv6']
82:   cloud[:public_hostname] = rackspace['public_hostname']
83:   cloud[:local_ipv4] = rackspace['local_ipv4']
84:   cloud[:local_ipv6] = rackspace['local_ipv6']
85:   cloud[:local_hostname] = rackspace['local_hostname']
86:   cloud[:provider] = "rackspace"
87: end

Is current cloud ec2?

Return

true:If ec2 Hash is defined
false:Otherwise

[Source]

    # File lib/ohai/plugins/cloud.rb, line 42
42: def on_ec2?
43:   ec2 != nil
44: end

Is current cloud eucalyptus?

Return

true:If eucalyptus Hash is defined
false:Otherwise

[Source]

     # File lib/ohai/plugins/cloud.rb, line 134
134: def on_eucalyptus?
135:   eucalyptus != nil
136: end

Is current cloud linode?

Return

true:If linode Hash is defined
false:Otherwise

[Source]

     # File lib/ohai/plugins/cloud.rb, line 104
104: def on_linode?
105:   linode != nil
106: end

Is current cloud openstack-based?

Return

true:If openstack Hash is defined
false:Otherwise

[Source]

     # File lib/ohai/plugins/cloud.rb, line 162
162: def on_openstack?
163:   openstack != nil
164: end

Is current cloud rackspace?

Return

true:If rackspace Hash is defined
false:Otherwise

[Source]

    # File lib/ohai/plugins/cloud.rb, line 72
72: def on_rackspace?
73:   rackspace != nil
74: end

[Validate]