Module: VagrantPlugins::Deltacloud::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-deltacloud-provider/action.rb,
lib/vagrant-deltacloud-provider/action/resume.rb,
lib/vagrant-deltacloud-provider/action/message.rb,
lib/vagrant-deltacloud-provider/action/suspend.rb,
lib/vagrant-deltacloud-provider/action/wait_stop.rb,
lib/vagrant-deltacloud-provider/action/read_state.rb,
lib/vagrant-deltacloud-provider/action/stop_server.rb,
lib/vagrant-deltacloud-provider/action/wait_active.rb,
lib/vagrant-deltacloud-provider/action/start_server.rb,
lib/vagrant-deltacloud-provider/action/sync_folders.rb,
lib/vagrant-deltacloud-provider/action/create_server.rb,
lib/vagrant-deltacloud-provider/action/delete_server.rb,
lib/vagrant-deltacloud-provider/action/read_ssh_info.rb,
lib/vagrant-deltacloud-provider/action/abstract_action.rb,
lib/vagrant-deltacloud-provider/action/wait_accessible.rb

Defined Under Namespace

Classes: AbstractAction, CreateServer, DeleteServer, Message, NoSyncFolders, ReadSSHInfo, ReadState, Resume, RsyncFolders, SSHInfoHolder, StartServer, StopServer, Suspend, SyncFolders, WaitForServerToBeAccessible, WaitForServerToBeActive, WaitForServerToStop

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to destroy the remote machine.



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-deltacloud-provider/action.rb', line 12

def self.action_destroy
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use DeleteServer
      end
    end
  end
end

.action_haltObject



108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/vagrant-deltacloud-provider/action.rb', line 108

def self.action_halt
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use StopServer
      end
    end
  end
end

.action_provisionObject

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



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/vagrant-deltacloud-provider/action.rb', line 26

def self.action_provision
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use Provision
        b2.use SyncFolders
      end
    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.



43
44
45
46
47
48
# File 'lib/vagrant-deltacloud-provider/action.rb', line 43

def self.action_read_ssh_info
  new_builder.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.



53
54
55
56
57
58
# File 'lib/vagrant-deltacloud-provider/action.rb', line 53

def self.action_read_state
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ReadState
  end
end

.action_reloadObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/vagrant-deltacloud-provider/action.rb', line 153

def self.action_reload
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      when :suspended
        b2.use Resume
        b2.use WaitForServerToBeActive
        b2.use StopServer
        b2.use WaitForServerToStop
        b2.use StartServer
      when :shutoff
        b2.use StartServer
      else
        b2.use StopServer
        b2.use WaitForServerToStop
        b2.use StartServer
      end
    end
  end
end

.action_resumeObject

This is the action that is primarily responsible for resuming suspended machines.



140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/vagrant-deltacloud-provider/action.rb', line 140

def self.action_resume
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use Resume
      end
    end
  end
end

.action_sshObject



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vagrant-deltacloud-provider/action.rb', line 60

def self.action_ssh
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use SSHExec
      end
    end
  end
end

.action_ssh_runObject



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/vagrant-deltacloud-provider/action.rb', line 73

def self.action_ssh_run
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      else
        b2.use SSHRun
      end
    end
  end
end

.action_suspendObject

This is the action that is primarily responsible for suspending the virtual machine.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/vagrant-deltacloud-provider/action.rb', line 123

def self.action_suspend
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use Call, ReadState do |env, b2|
      if env[:machine_state_id] == :not_created
        b2.use Message, I18n.t('vagrant_deltacloud.not_created')
      elsif env[:machine_state_id] == :suspended
        b2.use Message, I18n.t('vagrant_deltacloud.already_suspended')
      else
        b2.use Suspend
      end
    end
  end
end

.action_upObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/vagrant-deltacloud-provider/action.rb', line 86

def self.action_up
  new_builder.tap do |b|
    b.use ConfigValidate

    b.use Call, ReadState do |env, b2|
      case env[:machine_state_id]
      when :not_created
        b2.use Provision
        b2.use SyncFolders
        b2.use CreateServer
        b2.use WaitForServerToBeAccessible
      when :shutoff
        b2.use StartServer
      when :suspended
        b2.use Resume
      else
        b2.use Message, I18n.t('vagrant_deltacloud.already_created')
      end
    end
  end
end