module Vcloud::Core::Fog
Constants
- FOG_CREDS_PASS_NAME
- TOKEN_ENV_VAR_NAME
Public Class Methods
check_credentials()
click to toggle source
Run any checks needed against the Fog
credentials currently only used to disallow plaintext passwords in .fog files.
# File lib/vcloud/core/fog.rb, line 32 def self.check_credentials check_plaintext_pass end
check_plaintext_pass()
click to toggle source
Check whether a plaintext password is in the Fog
config file
@return [void]
# File lib/vcloud/core/fog.rb, line 56 def self.check_plaintext_pass pass = fog_credentials_pass unless pass.nil? or pass.empty? raise "Found plaintext #{Vcloud::Core::Fog::FOG_CREDS_PASS_NAME} entry. Please set it to an empty string as storing passwords in plaintext is insecure. See http://gds-operations.github.io/vcloud-tools/usage/ for further information." end end
fog_credentials_pass()
click to toggle source
Attempt to load the password from the fog credentials file
@return [String, nil] The password if it could be loaded,
else nil.
# File lib/vcloud/core/fog.rb, line 40 def self.fog_credentials_pass begin pass = ::Fog.credentials[FOG_CREDS_PASS_NAME] rescue ::Fog::Errors::LoadError # Assume no password if Fog has been unable to load creds. # Suppresses a noisy error about missing credentials. pass = nil end pass end
logout()
click to toggle source
Logout an existing vCloud session, rendering the token unusable. Requires a FOG_VCLOUD_TOKEN environment variable to be set.
@return [Boolean] return true or raise an exception
# File lib/vcloud/core/fog.rb, line 17 def self.logout unless ENV[TOKEN_ENV_VAR_NAME] raise "#{TOKEN_ENV_VAR_NAME} environment variable is not set" end fsi = Vcloud::Core::Fog::ServiceInterface.new fsi.logout return true end