diff options
author | kaustubh-d <kaustubh@clogeny.com> | 2013-06-05 08:20:28 +0530 |
---|---|---|
committer | adamedx <adamed@opscode.com> | 2013-06-21 20:54:50 -0700 |
commit | a711fb108a7fb9f25dda2dae8c0c85995e4e1a7b (patch) | |
tree | 0b8a4ffda50b22d6f39c5f6807477981eeea8d19 /lib | |
parent | 7247abbb00dfccaf29ec50712852882d6b347557 (diff) | |
download | ohai-a711fb108a7fb9f25dda2dae8c0c85995e4e1a7b.tar.gz |
azure ohai plugin to set cloud attributes from hints file.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ohai/plugins/azure.rb | 13 | ||||
-rw-r--r-- | lib/ohai/plugins/cloud.rb | 29 |
2 files changed, 42 insertions, 0 deletions
diff --git a/lib/ohai/plugins/azure.rb b/lib/ohai/plugins/azure.rb new file mode 100644 index 00000000..d13a388f --- /dev/null +++ b/lib/ohai/plugins/azure.rb @@ -0,0 +1,13 @@ + +provides "azure" + + +azure_metadata_from_hints = hint?('azure') +if azure_metadata_from_hints + Ohai::Log.debug("azure_metadata_from_hints is present.") + azure Mash.new + azure_metadata_from_hints.each {|k, v| azure[k] = v } +else + Ohai::Log.debug("No hints present for azure.") + false +end
\ No newline at end of file diff --git a/lib/ohai/plugins/cloud.rb b/lib/ohai/plugins/cloud.rb index 68852d04..0d5e9273 100644 --- a/lib/ohai/plugins/cloud.rb +++ b/lib/ohai/plugins/cloud.rb @@ -22,6 +22,7 @@ require_plugin "rackspace" require_plugin "eucalyptus" require_plugin "linode" require_plugin "openstack" +require_plugin "azure" # Make top-level cloud hashes # @@ -215,3 +216,31 @@ if on_openstack? create_objects get_openstack_values end + +# ---------------------------------------- +# azure +# ---------------------------------------- + +# Is current cloud azure? +# +# === Return +# true:: If azure Hash is defined +# false:: Otherwise +def on_azure? + azure != nil +end + +# Fill cloud hash with azure values +def get_azure_values + cloud[:public_ip] = azure['public_ip'] + cloud[:public_hostname] = azure['public_hostname'] + cloud[:public_ssh_port] = azure['public_ssh_port'] if azure['public_ssh_port'] + cloud[:public_winrm_port] = azure['public_winrm_port'] if azure['public_winrm_port'] + cloud[:provider] = "azure" +end + +# setup azure cloud data +if on_azure? + create_objects + get_azure_values +end
\ No newline at end of file |