2010-06-10 22:04:06 -04:00
|
|
|
module Fog
|
|
|
|
module Errors
|
|
|
|
|
|
|
|
class Error < StandardError
|
|
|
|
attr_accessor :verbose
|
2010-06-12 02:11:02 -04:00
|
|
|
|
|
|
|
def self.slurp(error, message = nil)
|
2013-06-14 01:55:04 -04:00
|
|
|
new_error = new(message || error.message)
|
2010-06-12 02:11:02 -04:00
|
|
|
new_error.set_backtrace(error.backtrace)
|
|
|
|
new_error.verbose = error.message
|
|
|
|
new_error
|
|
|
|
end
|
2010-06-10 22:04:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class MockNotImplemented < Fog::Errors::Error; end
|
|
|
|
|
|
|
|
class NotFound < Fog::Errors::Error; end
|
|
|
|
|
2011-08-14 09:03:43 -04:00
|
|
|
class LoadError < LoadError; end
|
2013-06-14 01:55:04 -04:00
|
|
|
|
2012-12-12 13:14:44 -05:00
|
|
|
class TimeoutError< Fog::Errors::Error; end
|
2013-06-14 01:55:04 -04:00
|
|
|
|
2013-02-01 17:16:37 -05:00
|
|
|
class NotImplemented < Fog::Errors::Error; end
|
2011-08-14 09:03:43 -04:00
|
|
|
|
2011-05-04 16:12:52 -04:00
|
|
|
# @return [String] The error message that will be raised, if credentials cannot be found
|
|
|
|
def self.missing_credentials
|
|
|
|
missing_credentials_message = <<-YML
|
|
|
|
Missing Credentials
|
|
|
|
|
|
|
|
To run as '#{Fog.credential}', add the following to your resource config file: #{Fog.credentials_path}
|
|
|
|
An alternate file may be used by placing its path in the FOG_RC environment variable
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# Fog Credentials File
|
|
|
|
#
|
|
|
|
# Key-value pairs should look like:
|
|
|
|
# :aws_access_key_id: 022QF06E7MXBSAMPLE
|
|
|
|
:#{Fog.credential}:
|
|
|
|
:aws_access_key_id:
|
|
|
|
:aws_secret_access_key:
|
|
|
|
:bluebox_api_key:
|
|
|
|
:bluebox_customer_id:
|
|
|
|
:brightbox_client_id:
|
|
|
|
:brightbox_secret:
|
2011-09-30 17:46:05 -04:00
|
|
|
:clodo_api_key:
|
|
|
|
:clodo_username:
|
2011-05-04 16:12:52 -04:00
|
|
|
:go_grid_api_key:
|
|
|
|
:go_grid_shared_secret:
|
2013-03-26 21:19:20 -04:00
|
|
|
:google_client_email:
|
|
|
|
:google_key_location:
|
2012-12-26 20:48:55 -05:00
|
|
|
:google_project:
|
2011-05-04 16:12:52 -04:00
|
|
|
:google_storage_access_key_id:
|
|
|
|
:google_storage_secret_access_key:
|
2013-01-22 17:28:33 -05:00
|
|
|
:hp_access_key:
|
2011-06-15 02:10:54 -04:00
|
|
|
:hp_secret_key:
|
|
|
|
:hp_tenant_id:
|
2012-04-26 16:49:42 -04:00
|
|
|
:hp_avl_zone:
|
2011-05-04 16:12:52 -04:00
|
|
|
:linode_api_key:
|
|
|
|
:local_root:
|
2012-03-01 21:54:49 -05:00
|
|
|
:bare_metal_cloud_password:
|
|
|
|
:bare_metal_cloud_username:
|
2011-05-04 16:12:52 -04:00
|
|
|
:public_key_path:
|
|
|
|
:private_key_path:
|
2011-09-26 02:41:54 -04:00
|
|
|
:openstack_api_key:
|
|
|
|
:openstack_username:
|
|
|
|
:openstack_auth_url:
|
|
|
|
:openstack_tenant:
|
2012-07-16 11:28:28 -04:00
|
|
|
:openstack_region:
|
2012-02-08 06:58:10 -05:00
|
|
|
:ovirt_username:
|
|
|
|
:ovirt_password:
|
|
|
|
:ovirt_url:
|
2012-04-05 10:02:45 -04:00
|
|
|
:libvirt_uri:
|
2011-05-04 16:12:52 -04:00
|
|
|
:rackspace_api_key:
|
|
|
|
:rackspace_username:
|
2013-10-10 10:00:46 -04:00
|
|
|
:rackspace_servicenet:
|
|
|
|
:rackspace_cdn_ssl:
|
2012-03-28 17:34:50 -04:00
|
|
|
:riakcs_access_key_id:
|
|
|
|
:riakcs_secret_access_key:
|
2011-05-04 16:12:52 -04:00
|
|
|
:stormondemand_username:
|
|
|
|
:stormondemand_password:
|
|
|
|
:terremark_username:
|
|
|
|
:terremark_password:
|
|
|
|
:voxel_api_key:
|
|
|
|
:voxel_api_secret:
|
|
|
|
:zerigo_email:
|
|
|
|
:zerigo_token:
|
|
|
|
:dnsimple_email:
|
|
|
|
:dnsimple_password:
|
2011-05-29 19:41:27 -04:00
|
|
|
:dnsmadeeasy_api_key:
|
|
|
|
:dnsmadeeasy_secret_key:
|
2012-03-10 17:02:28 -05:00
|
|
|
:dreamhost_api_key:
|
2011-10-10 00:37:26 -04:00
|
|
|
:cloudstack_host:
|
|
|
|
:cloudstack_api_key:
|
|
|
|
:cloudstack_secret_access_key:
|
2011-08-29 23:04:04 -04:00
|
|
|
:vsphere_server:
|
|
|
|
:vsphere_username:
|
|
|
|
:vsphere_password:
|
2011-09-12 10:08:29 -04:00
|
|
|
:libvirt_username:
|
|
|
|
:libvirt_password:
|
|
|
|
:libvirt_uri:
|
2011-09-12 10:12:32 -04:00
|
|
|
:libvirt_ip_command:
|
2012-01-10 17:20:56 -05:00
|
|
|
:ibm_username:
|
|
|
|
:ibm_password:
|
2013-09-05 19:03:09 -04:00
|
|
|
:vcloud_director_host:
|
|
|
|
:vcloud_director_username:
|
|
|
|
:vcloud_director_password:
|
2011-05-04 16:12:52 -04:00
|
|
|
#
|
|
|
|
# End of Fog Credentials File
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
YML
|
2012-05-14 13:55:50 -04:00
|
|
|
raise(Fog::Errors::LoadError.new(missing_credentials_message))
|
|
|
|
end
|
2011-05-04 16:12:52 -04:00
|
|
|
|
2010-06-10 22:04:06 -04:00
|
|
|
end
|
2011-08-29 23:04:04 -04:00
|
|
|
end
|