Module: VagrantPlugins::Rimu::Actions

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-rimu/actions.rb,
lib/vagrant-rimu/actions/move.rb,
lib/vagrant-rimu/actions/create.rb,
lib/vagrant-rimu/actions/reload.rb,
lib/vagrant-rimu/actions/rebuild.rb,
lib/vagrant-rimu/actions/ssh_utils.rb,
lib/vagrant-rimu/actions/is_created.rb,
lib/vagrant-rimu/actions/is_stopped.rb,
lib/vagrant-rimu/actions/read_state.rb,
lib/vagrant-rimu/actions/setup_sudo.rb,
lib/vagrant-rimu/actions/setup_user.rb,
lib/vagrant-rimu/actions/list_servers.rb,
lib/vagrant-rimu/actions/read_ssh_info.rb,
lib/vagrant-rimu/actions/stop_instance.rb,
lib/vagrant-rimu/actions/start_instance.rb,
lib/vagrant-rimu/actions/abstract_action.rb,
lib/vagrant-rimu/actions/billing_methods.rb,
lib/vagrant-rimu/actions/connect_to_rimu.rb,
lib/vagrant-rimu/actions/list_distributions.rb,
lib/vagrant-rimu/actions/terminate_instance.rb,
lib/vagrant-rimu/actions/message_already_off.rb,
lib/vagrant-rimu/actions/message_not_created.rb,
lib/vagrant-rimu/actions/message_will_not_stop.rb,
lib/vagrant-rimu/actions/modify_provision_path.rb,
lib/vagrant-rimu/actions/message_already_created.rb,
lib/vagrant-rimu/actions/message_will_not_destroy.rb,
lib/vagrant-rimu/actions/message_action_not_supported.rb

Overview

rubocop:disable Metrics/ModuleLength

Defined Under Namespace

Modules: SshUtils Classes: AbstractAction, BillingMethods, ConnectToRimu, Create, IsCreated, IsStopped, ListDistributions, ListServers, MessageActionNotSupported, MessageAlreadyCreated, MessageAlreadyOff, MessageNotCreated, MessageWillNotDestroy, MessageWillNotStop, ModifyProvisionPath, Move, ReadSSHInfo, ReadState, Rebuild, Reload, SetupSudo, SetupUser, StartInstance, StopInstance, TerminateInstance

Class Method Summary collapse

Class Method Details

.action_billing_methodsObject



195
196
197
198
199
200
201
# File 'lib/vagrant-rimu/actions.rb', line 195

def self.action_billing_methods
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use BillingMethods
  end
end

.action_destroyObject

This action is called to terminate the remote machine.



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

def self.action_destroy
  new_builder.tap do |b|
    b.use Call, DestroyConfirm do |env, b1|
      if env[:result]
        b1.use ConfigValidate
        b1.use ConnectToRimu
        b1.use Call, ReadState do |env1, b2|
          if env1[:machine_state] == :not_created
            b2.use MessageNotCreated
          else
            b2.use TerminateInstance
          end
        end
      else
        b1.use MessageWillNotDestroy
      end
    end
  end
end

.action_haltObject

This action is called to halt the remote machine.



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/vagrant-rimu/actions.rb', line 125

def self.action_halt
  new_builder.tap do |b|
    b.use MessageWillNotStop
    # b.use ConfigValidate
    # b.use ConnectToRimu
    # b.use Call, ReadState do |env, b1|
    #   case env[:machine_state]
    #     when :not_created
    #       b1.use MessageNotCreated
    #     when :off
    #       b1.use MessageAlreadyOff
    #     else
    #       b1.use StopInstance
    #   end
    # end
  end
end

.action_list_distributionsObject



179
180
181
182
183
184
185
# File 'lib/vagrant-rimu/actions.rb', line 179

def self.action_list_distributions
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use ListDistributions
  end
end

.action_list_serversObject



187
188
189
190
191
192
193
# File 'lib/vagrant-rimu/actions.rb', line 187

def self.action_list_servers
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use ListServers
  end
end

.action_moveObject



203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/vagrant-rimu/actions.rb', line 203

def self.action_move
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      case env[:machine_state]
      when :active, :off
        b1.use Move
      when :not_created
        b1.use MessageNotCreated
      end
    end
  end
end

.action_provisionObject

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



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/vagrant-rimu/actions.rb', line 84

def self.action_provision
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      case env[:machine_state]
      when :active
        b1.use Provision
        b1.use ModifyProvisionPath
        b1.use SyncedFolders
      when :off
        env[:ui].info I18n.t('vagrant_rimu.off')
      when :not_created
        b1.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.



35
36
37
38
39
40
41
# File 'lib/vagrant-rimu/actions.rb', line 35

def self.action_read_ssh_info
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    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` key.



46
47
48
49
50
51
52
# File 'lib/vagrant-rimu/actions.rb', line 46

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

.action_rebuildObject



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

def self.action_rebuild
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      case env[:machine_state]
      when :active, :off
        b1.use Rebuild
        b1.use SetupSudo
        b1.use SetupUser
        b1.use action_provision
      when :not_created
        b1.use MessageNotCreated
      end
    end
  end
end

.action_reloadObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/vagrant-rimu/actions.rb', line 143

def self.action_reload
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      case env[:machine_state]
      when :not_created
        b1.use MessageNotCreated
      when :off
        env[:ui].info I18n.t('vagrant_rimu.off')
      else
        b1.use Reload
        b1.use action_provision
      end
    end
  end
end

.action_resumeObject



225
226
227
228
229
230
# File 'lib/vagrant-rimu/actions.rb', line 225

def self.action_resume
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use MessageActionNotSupported
  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-rimu/actions.rb', line 55

def self.action_ssh
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      if env[:machine_state] == :not_created
        b1.use MessageNotCreated
      else
        b1.use SSHExec
      end
    end
  end
end

.action_ssh_runObject



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

def self.action_ssh_run
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      if env[:machine_state] == :not_created
        b1.use MessageNotCreated
      else
        b1.use SSHRun
      end
    end
  end
end

.action_suspendObject



218
219
220
221
222
223
# File 'lib/vagrant-rimu/actions.rb', line 218

def self.action_suspend
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use MessageActionNotSupported
  end
end

.action_upObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/vagrant-rimu/actions.rb', line 103

def self.action_up
  new_builder.tap do |b|
    b.use ConfigValidate
    b.use ConnectToRimu
    b.use Call, ReadState do |env, b1|
      case env[:machine_state]
      when :not_created
        b1.use Create
        b1.use SetupSudo
        b1.use SetupUser
        b1.use action_provision
      when :off
        b1.use StartInstance
        b1.use action_provision
      else
        b1.use MessageAlreadyCreated
      end
    end
  end
end