lib/process/cloud/providers/hpcloud/hpcloud.rb in lorj_cloud-0.1.1 vs lib/process/cloud/providers/hpcloud/hpcloud.rb in lorj_cloud-0.1.2

- old
+ new

@@ -97,15 +97,17 @@ def_attr_mapping :gateway_network_id, [:external_gateway_info, 'network_id'] # ************************************ SERVER Object define_obj :server + def_attr_mapping :private_ip_addresses, [:addresses, '{key}', [:addr]] def_attr_mapping :status, :state - attr_value_mapping :create, 'BUILD' - attr_value_mapping :boot, :boot - attr_value_mapping :active, 'ACTIVE' - attr_value_mapping :error, 'ERROR' + attr_value_mapping :create, 'BUILD' + attr_value_mapping :boot, :boot + attr_value_mapping :active, 'ACTIVE' + attr_value_mapping :error, 'ERROR' + attr_value_mapping :shutdown, 'SHUTOFF' # ************************************ SERVER log Object define_obj :server_log # Excon::Response object type @@ -340,11 +342,11 @@ required?(hParams, :server) HPCompute.delete_server(hParams[:compute_connection], hParams[:server]) end end - + # rubocop: disable CyclomaticComplexity, def get(sObjectType, sUniqId, hParams) case sObjectType when :server_log required?(hParams, :server) @@ -359,13 +361,19 @@ required?(hParams, :network_connection) HPNetwork.get_network(hParams[:network_connection], sUniqId) when :keypairs required?(hParams, :compute_connection) HPKeyPairs.get_keypair(hParams[:compute_connection], sUniqId) + when :public_ip + required?(hParams, :compute_connection) + required?(hParams, :server) + HPCompute.get_server_assigned_address(hParams[:compute_connection], + sUniqId) else forjError "'%s' is not a valid object for 'get'", sObjectType end end + # rubocop: enable CyclomaticComplexity def query_each(oFogObject) case oFogObject.class.to_s when 'Fog::HP::Network::Networks' oFogObject.each { |value| yield(value) }