Created
August 8, 2016 06:42
-
-
Save voelzmo/26f75e9929abe3a81946f3ec0ee666da to your computer and use it in GitHub Desktop.
create lambda with context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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