Module: VagrantPlugins::Shell::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-shell/action.rb,
lib/vagrant-shell/action/is_created.rb,
lib/vagrant-shell/action/read_state.rb,
lib/vagrant-shell/action/run_instance.rb,
lib/vagrant-shell/action/read_ssh_info.rb,
lib/vagrant-shell/action/timed_provision.rb,
lib/vagrant-shell/action/terminate_instance.rb,
lib/vagrant-shell/action/message_not_created.rb,
lib/vagrant-shell/action/message_already_created.rb

Defined Under Namespace

Classes: IsCreated, MessageAlreadyCreated, MessageNotCreated, ReadSSHInfo, ReadState, RunInstance, TerminateInstance, TimedProvision

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to terminate the remote machine.



12
13
14
15
16
17
# File 'lib/vagrant-shell/action.rb', line 12

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use TerminateInstance
  end
end

.action_provisionObject

This action is called when ‘vagrant provision` is called.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-shell/action.rb', line 20

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Provision
    end
  end
end

.action_read_ssh_infoObject

This action is called to read the SSH info of the machine. The resulting state is expected to be put into the ‘:machine_ssh_info` key.



37
38
39
40
41
42
# File 'lib/vagrant-shell/action.rb', line 37

def self.action_read_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ReadSSHInfo
  end
end

.action_read_stateObject

This action is called to read the state of the machine. The resulting state is expected to be put into the ‘:machine_state_id` key.



47
48
49
50
51
52
# File 'lib/vagrant-shell/action.rb', line 47

def self.action_read_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ReadState
  end
end

.action_sshObject

This action is called to SSH into the machine.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vagrant-shell/action.rb', line 55

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHExec
    end
  end
end

.action_ssh_runObject



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/vagrant-shell/action.rb', line 69

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHRun
    end
  end
end

.action_upObject

This action is called to bring the box up from nothing.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vagrant-shell/action.rb', line 84

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      if env[:result]
        b2.use MessageAlreadyCreated
        next
      end

      b2.use TimedProvision
      b2.use RunInstance
    end
  end
end