Skip to content

Instantly share code, notes, and snippets.

@voelzmo
Created August 8, 2016 06:42
Show Gist options
  • Save voelzmo/26f75e9929abe3a81946f3ec0ee666da to your computer and use it in GitHub Desktop.
Save voelzmo/26f75e9929abe3a81946f3ec0ee666da to your computer and use it in GitHub Desktop.
create lambda with context
json = JSON.load(ARGF.read)
cpi_lambda = lambda do
unless cpi_config.has_key?('cloud') && cpi_config['cloud'].has_key?('properties')
raise "Could not find cloud properties in the configuration"
end
cloud_properties = cpi_config['cloud']['properties']
if json['context'] && json['context']['cloud_properties']
# override credentials in above cloud_properties object
end
cloud_properties['cpi_log'] = cpi_log
connection_options = cloud_properties['openstack']['connection_options']
# If 'ca_cert' is set we render non-empty `config/openstack.crt`
if connection_options && connection_options['ca_cert']
connection_options['ssl_ca_file'] = ssl_ca_file
end
Bosh::Clouds::Openstack.new(cloud_properties)
end
cli = Bosh::Cpi::Cli.new(cpi_lambda, cpi_log, STDOUT)
cli.run(json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment