Class: Bosh::Deployer::MicroboshJobInstance
- Inherits:
-
Object
- Object
- Bosh::Deployer::MicroboshJobInstance
- Defined in:
- lib/bosh/deployer/microbosh_job_instance.rb
Instance Method Summary collapse
-
#initialize(blobstore_ip, mbus, logger) ⇒ MicroboshJobInstance
constructor
A new instance of MicroboshJobInstance.
- #render_templates(spec) ⇒ Object
Constructor Details
#initialize(blobstore_ip, mbus, logger) ⇒ MicroboshJobInstance
Returns a new instance of MicroboshJobInstance.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bosh/deployer/microbosh_job_instance.rb', line 9 def initialize(blobstore_ip, mbus, logger) @logger = logger uri = URI.parse(mbus) user, password = uri.userinfo.split(':', 2) uri.userinfo = '' uri.host = blobstore_ip uri.path = '/blobs' @blobstore_options = { 'endpoint' => uri.to_s, 'user' => user, 'password' => password, 'ssl_no_verify' => true, } end |
Instance Method Details
#render_templates(spec) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/bosh/deployer/microbosh_job_instance.rb', line 25 def render_templates(spec) blobstore = Bosh::Blobstore::DavBlobstoreClient.new() templates = spec['job']['templates'].map do |template| JobTemplate.new(template, blobstore) end job_template_loader = Bosh::Director::Core::Templates::JobTemplateLoader.new(logger) job_instance_renderer = Bosh::Director::Core::Templates::JobInstanceRenderer.new(templates, job_template_loader) rendered_job_instance = job_instance_renderer.render(spec) rendered_templates_archive = rendered_job_instance.persist(blobstore) spec.merge( 'rendered_templates_archive' => rendered_templates_archive.spec, 'configuration_hash' => rendered_job_instance.configuration_hash, ) rescue JobTemplate::FetchError logger.debug('skipping rendering since the agent appears to be ruby') spec end |