Module: Bosh::Bootstrap::Helpers::FogSetup
- Included in:
- Cli
- Defined in:
- lib/bosh-bootstrap/helpers/fog_setup.rb
Overview
A collection of methods related to getting fog_compute credentials for creating the inception VM and to provide to the MicroBOSH for its uses.
Attempts to look in settings.fog_path
to see if there is a .fog file.
Instance Method Summary collapse
-
#fog_compute ⇒ Object
fog connection object to Compute tasks (VMs, IP addresses).
- #fog_config ⇒ Object
- #fog_config_path ⇒ Object
- #reset_fog_compute ⇒ Object
Instance Method Details
#fog_compute ⇒ Object
fog connection object to Compute tasks (VMs, IP addresses)
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bosh-bootstrap/helpers/fog_setup.rb', line 14 def fog_compute @fog_compute ||= begin # Fog::Compute.new requires Hash with keys that are symbols # but Settings converts all keys to strings # So create a version of settings.fog_credentials with symbol keys credentials_with_symbols = settings.fog_credentials.inject({}) do |creds, key_pair| key, value = key_pair creds[key.to_sym] = value creds end Fog::Compute.new(credentials_with_symbols) end end |
#fog_config ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bosh-bootstrap/helpers/fog_setup.rb', line 34 def fog_config @fog_config ||= begin if File.exists?(fog_config_path) say "Found infrastructure API credentials at #{fog_config_path} (override with --fog)" YAML.load_file(fog_config_path) else say "No existing #{fog_config_path} fog configuration file", :yellow {} end end end |
#fog_config_path ⇒ Object
46 47 48 |
# File 'lib/bosh-bootstrap/helpers/fog_setup.rb', line 46 def fog_config_path settings.fog_path end |
#reset_fog_compute ⇒ Object
28 29 30 31 32 |
# File 'lib/bosh-bootstrap/helpers/fog_setup.rb', line 28 def reset_fog_compute @fog_compute = nil @provider = nil # in cli.rb - I don't like this; need one wrapper for all CPI/compute calls # or don't create fog_compute until we know all IaaS details end |