Class: Bosh::Cli::VmState

Inherits:
Object show all
Defined in:
lib/cli/vm_state.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, manifest, force) ⇒ VmState

Returns a new instance of VmState.



3
4
5
6
7
# File 'lib/cli/vm_state.rb', line 3

def initialize(command, manifest, force)
  @command = command
  @manifest = manifest
  @force = force
end

Instance Method Details

#change(job, index, new_state, operation_desc) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cli/vm_state.rb', line 9

def change(job, index, new_state, operation_desc)
  command.say("You are about to #{operation_desc.make_green}")

  check_if_manifest_changed(@manifest.hash)

  unless command.confirmed?("#{operation_desc.capitalize}?")
    command.cancel_deployment
  end

  command.nl
  command.say("Performing `#{operation_desc}'...")
  command.director.change_job_state(@manifest.name, @manifest.yaml, job, index, new_state)
end