Module: VagrantPlugins::Linode::Actions

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-linode/actions.rb,
lib/vagrant-linode/actions/create.rb,
lib/vagrant-linode/actions/reload.rb,
lib/vagrant-linode/actions/destroy.rb,
lib/vagrant-linode/actions/rebuild.rb,
lib/vagrant-linode/actions/power_on.rb,
lib/vagrant-linode/actions/power_off.rb,
lib/vagrant-linode/actions/is_created.rb,
lib/vagrant-linode/actions/is_stopped.rb,
lib/vagrant-linode/actions/list_plans.rb,
lib/vagrant-linode/actions/read_state.rb,
lib/vagrant-linode/actions/setup_sudo.rb,
lib/vagrant-linode/actions/setup_user.rb,
lib/vagrant-linode/actions/list_images.rb,
lib/vagrant-linode/actions/message_off.rb,
lib/vagrant-linode/actions/create_image.rb,
lib/vagrant-linode/actions/list_kernels.rb,
lib/vagrant-linode/actions/list_servers.rb,
lib/vagrant-linode/actions/list_volumes.rb,
lib/vagrant-linode/actions/read_ssh_info.rb,
lib/vagrant-linode/actions/connect_linode.rb,
lib/vagrant-linode/actions/setup_hostname.rb,
lib/vagrant-linode/actions/message_not_off.rb,
lib/vagrant-linode/actions/list_datacenters.rb,
lib/vagrant-linode/actions/list_distributions.rb,
lib/vagrant-linode/actions/message_already_off.rb,
lib/vagrant-linode/actions/message_not_created.rb,
lib/vagrant-linode/actions/modify_provision_path.rb,
lib/vagrant-linode/actions/message_already_active.rb

Defined Under Namespace

Classes: ConnectLinode, Create, CreateImage, Destroy, IsCreated, IsStopped, ListDatacenters, ListDistributions, ListImages, ListKernels, ListPlans, ListServers, ListVolumes, MessageAlreadyActive, MessageAlreadyOff, MessageNotCreated, MessageNotOff, MessageOff, ModifyProvisionPath, PowerOff, PowerOn, ReadSSHInfo, ReadState, Rebuild, Reload, SetupHostname, SetupSudo, SetupUser

Class Method Summary collapse

Class Method Details

.action_create_imageObject

Extended actions



203
204
205
206
207
208
209
# File 'lib/vagrant-linode/actions.rb', line 203

def self.action_create_image
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use CreateImage
  end
end

.action_destroyObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-linode/actions.rb', line 10

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if !env[:result]
        b.use MessageNotCreated
      else
        b.use Call, DestroyConfirm do |env2, b2|
          if env2[:result]
            b2.use ConnectLinode
            b2.use Destroy
            b2.use ProvisionerCleanup if defined?(ProvisionerCleanup)
          end
        end
      end
    end
  end
end

.action_haltObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/vagrant-linode/actions.rb', line 137

def self.action_halt
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b1|
      if env[:result]
        b1.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use MessageAlreadyOff
          else
            b2.use ConnectLinode
            b2.use PowerOff
          end
        end
      else
        b1.use MessageNotCreated
      end
    end
  end
end

.action_list_datacentersObject



235
236
237
238
239
240
241
# File 'lib/vagrant-linode/actions.rb', line 235

def self.action_list_datacenters
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListDatacenters
  end
end

.action_list_distributionsObject



243
244
245
246
247
248
249
# File 'lib/vagrant-linode/actions.rb', line 243

def self.action_list_distributions
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListDistributions
  end
end

.action_list_imagesObject



211
212
213
214
215
216
217
# File 'lib/vagrant-linode/actions.rb', line 211

def self.action_list_images
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListImages
  end
end

.action_list_kernelsObject



251
252
253
254
255
256
257
# File 'lib/vagrant-linode/actions.rb', line 251

def self.action_list_kernels
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListKernels
  end
end

.action_list_plansObject



227
228
229
230
231
232
233
# File 'lib/vagrant-linode/actions.rb', line 227

def self.action_list_plans
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListPlans
  end
end

.action_list_serversObject



219
220
221
222
223
224
225
# File 'lib/vagrant-linode/actions.rb', line 219

def self.action_list_servers
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListServers
  end
end

.action_list_volumesObject



259
260
261
262
263
264
265
# File 'lib/vagrant-linode/actions.rb', line 259

def self.action_list_volumes
  Vagrant::Action::Builder.new.tap do |b|
    # b.use ConfigValidate # is this per machine?
    b.use ConnectLinode
    b.use ListVolumes
  end
end

.action_provisionObject



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

def self.action_provision
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use MessageOff
          else
            b2.use Provision
            b2.use ModifyProvisionPath
            b2.use SyncedFolders
          end
        end
      else
        b.use MessageNotCreated
      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.



32
33
34
35
36
37
38
# File 'lib/vagrant-linode/actions.rb', line 32

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

.action_read_stateObject



40
41
42
43
44
45
46
# File 'lib/vagrant-linode/actions.rb', line 40

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

.action_rebuildObject



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/vagrant-linode/actions.rb', line 178

def self.action_rebuild
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use ConnectLinode
            b2.use Rebuild
            b2.use SetupSudo
            b2.use SetupUser
            b2.use SetupHostname
            b2.use Provision
          else
            b2.use MessageNotOff
          end
        end
      else
        b2.use MessageNotCreated
      end
    end
  end
end

.action_reloadObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/vagrant-linode/actions.rb', line 157

def self.action_reload
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use MessageOff
          else
            b2.use ConnectLinode
            b2.use Reload
            b2.use Provision
          end
        end
      else
        b.use MessageNotCreated
      end
    end
  end
end

.action_sshObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/vagrant-linode/actions.rb', line 48

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use MessageOff
          else
            b2.use SSHExec
          end
        end
      else
        b.use MessageNotCreated
      end
    end
  end
end

.action_ssh_runObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/vagrant-linode/actions.rb', line 67

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use SSHRun
      else
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use MessageOff
          else
            b2.use MessageNotCreated
          end
        end
      end
    end
  end
end

.action_upObject



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/vagrant-linode/actions.rb', line 107

def self.action_up
  Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, IsCreated do |env, b|
      if env[:result]
        b.use Call, IsStopped do |env2, b2|
          if env2[:result]
            b2.use Provision
            b2.use SyncedFolders
            b2.use MessageOff
            b2.use ConnectLinode
            b2.use PowerOn
          else
            b2.use MessageAlreadyActive
          end
        end
      else
        b.use Provision
        b.use SyncedFolders
        b.use MessageNotCreated
        b.use ConnectLinode
        b.use Create
        b.use SetupSudo
        b.use SetupUser
        b.use SetupHostname
      end
    end
  end
end