Class: Kdeploy::TemplateUploadCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/kdeploy/dsl.rb

Overview

Command class for template upload operations

Instance Attribute Summary

Attributes inherited from Command

#command, #name, #options, #result

Instance Method Summary collapse

Methods inherited from Command

#should_run_on?

Constructor Details

#initialize(template_name, remote_path, variables, template_manager, global_variables = {}) ⇒ TemplateUploadCommand

Returns a new instance of TemplateUploadCommand.



491
492
493
494
495
496
497
498
# File 'lib/kdeploy/dsl.rb', line 491

def initialize(template_name, remote_path, variables, template_manager, global_variables = {})
  @template_name = template_name
  @remote_path = remote_path
  @variables = variables
  @template_manager = template_manager
  @global_variables = global_variables
  super()
end

Instance Method Details

#execute(host, connection) ⇒ Object



500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/kdeploy/dsl.rb', line 500

def execute(host, connection)
  start_time = Time.now
  host_variables = build_host_variables(host)
  processed_path = process_remote_path_variables(host_variables)

  begin
    perform_template_upload(host, connection, host_variables, processed_path)
    record_success(start_time, host)
  rescue StandardError => e
    record_failure(e, start_time, host)
    raise
  end
end