Class: Bosh::Cli::Command::Biff

Inherits:
Base show all
Defined in:
lib/cli/commands/biff.rb

Constant Summary

Constants inherited from Base

Bosh::Cli::Command::Base::BLOBS_DIR, Bosh::Cli::Command::Base::BLOBS_INDEX_FILE

Instance Attribute Summary

Attributes inherited from Base

#cache, #config, #options, #out, #usage, #work_dir

Instance Method Summary collapse

Methods inherited from Base

#blob_manager, #blobstore, command, #confirmed?, #director, #dry_run?, #exit_code, #full_target_name, #initialize, #interactive?, #logged_in?, #non_interactive?, #redirect, #release, #run, #show_usage, #target_name, #target_version, #task_report, #verbose?

Constructor Details

This class inherits a constructor from Bosh::Cli::Command::Base

Instance Method Details

#biff(template) ⇒ Object

Takes your current deployment configuration and uses some of its configuration to populate the template file. The Network information is used and then IPs for each job are automatically set. Once the template file has been used to generate a new config, the old config and new config are diff’d and the user can choose to keep the new config.

Parameters:

  • template (String)

    The string path to the template that should be used.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cli/commands/biff.rb', line 11

def biff(template)
  begin
    setup(template)

    template_to_fill = ERB.new(File.read(@template_file), 0, "%<>-")
    @template_output = template_to_fill.result(binding)

    if @errors == 0
      print_string_diff(File.read(@deployment_file), @template_output)
      keep_new_file unless @no_differences
    else
      say("There were " + "#{@errors} errors.".red)
    end
  ensure
    delete_temp_diff_files
  end
end