Module: Vcloud::Core::Fog
- Defined in:
- lib/vcloud/core/fog.rb,
lib/vcloud/core/fog/login.rb,
lib/vcloud/core/fog/fog_constants.rb,
lib/vcloud/core/fog/model_interface.rb,
lib/vcloud/core/fog/service_interface.rb
Defined Under Namespace
Modules: ContentTypes, Login, MetadataValueType, RELATION Classes: ModelInterface, ServiceInterface
Constant Summary collapse
- TOKEN_ENV_VAR_NAME =
'FOG_VCLOUD_TOKEN'
- FOG_CREDS_PASS_NAME =
:vcloud_director_password
Class Method Summary collapse
-
.check_credentials ⇒ Object
Run any checks needed against the Fog credentials currently only used to disallow plaintext passwords in .fog files.
-
.check_plaintext_pass ⇒ void
Check whether a plaintext password is in the Fog config file.
-
.fog_credentials_pass ⇒ String?
Attempt to load the password from the fog credentials file.
-
.logout ⇒ Boolean
Logout an existing vCloud session, rendering the token unusable.
Class Method Details
.check_credentials ⇒ Object
Run any checks needed against the Fog credentials currently only used to disallow plaintext passwords in .fog files.
32 33 34 |
# File 'lib/vcloud/core/fog.rb', line 32 def self.check_credentials check_plaintext_pass end |
.check_plaintext_pass ⇒ void
This method returns an undefined value.
Check whether a plaintext password is in the Fog config file
56 57 58 59 60 61 |
# 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 ⇒ String?
Attempt to load the password from the fog credentials file
40 41 42 43 44 45 46 47 48 49 50 |
# 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 ⇒ Boolean
Logout an existing vCloud session, rendering the token unusable. Requires a FOG_VCLOUD_TOKEN environment variable to be set.
17 18 19 20 21 22 23 24 25 26 |
# 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 |