Skip to content

Commit

Permalink
Add alibaba to the cloud plugin
Browse files Browse the repository at this point in the history
This way you get the cloud info when on Alibaba

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 committed Feb 8, 2021
1 parent 49f2cae commit dfa4e2a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/ohai/plugins/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Ohai.plugin(:Cloud) do
provides "cloud"

depends "alibaba"
depends "ec2"
depends "gce"
depends "rackspace"
Expand Down Expand Up @@ -118,7 +119,22 @@ def validate_ip_addr(ip, address_family = :ipv4)
end
end

#---------------------------------------
#--------------------------------------
# Alibaba Cloud
#--------------------------------------

def on_alibaba?
alibaba != nil
end

def get_alibaba_values
@cloud_attr_obj.add_ipv4_addr(alibaba["metadata"]["eipv4"], :public)
@cloud_attr_obj.add_ipv4_addr(alibaba["metadata"]["private_ipv4"], :private)
@cloud_attr_obj.local_hostname = alibaba["metadata"]["hostname"]
@cloud_attr_obj.provider = "alibaba"
end

#--------------------------------------
# Google Compute Engine (gce)
#--------------------------------------

Expand Down Expand Up @@ -334,6 +350,7 @@ def get_softlayer_values
get_azure_values if on_azure?
get_digital_ocean_values if on_digital_ocean?
get_softlayer_values if on_softlayer?
get_alibaba_values if on_alibaba?

cloud @cloud_attr_obj.cloud_mash
end
Expand Down

0 comments on commit dfa4e2a

Please sign in to comment.