Module: VagrantPlugins::OneCloud::Actions

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-1cloud/actions.rb,
lib/vagrant-1cloud/actions/create.rb,
lib/vagrant-1cloud/actions/reload.rb,
lib/vagrant-1cloud/actions/destroy.rb,
lib/vagrant-1cloud/actions/rebuild.rb,
lib/vagrant-1cloud/actions/power_on.rb,
lib/vagrant-1cloud/actions/power_off.rb,
lib/vagrant-1cloud/actions/setup_key.rb,
lib/vagrant-1cloud/actions/shut_down.rb,
lib/vagrant-1cloud/actions/setup_sudo.rb,
lib/vagrant-1cloud/actions/setup_user.rb,
lib/vagrant-1cloud/actions/check_state.rb,
lib/vagrant-1cloud/actions/private_network.rb,
lib/vagrant-1cloud/actions/modify_provision_path.rb

Defined Under Namespace

Classes: CheckState, Create, Destroy, ModifyProvisionPath, PowerOff, PowerOn, PrivateNetwork, Rebuild, Reload, SetupKey, SetupSudo, SetupUser, ShutDown

Class Method Summary collapse

Class Method Details

.addnetObject



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/vagrant-1cloud/actions.rb', line 89

def self.addnet
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          b.use PrivateNetwork
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.destroyObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-1cloud/actions.rb', line 20

def self.destroy
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
        else
          b.use Call, DestroyConfirm do |env2, b2|
            if env2[:result]
              b2.use Destroy
              b2.use ProvisionerCleanup if defined?(ProvisionerCleanup)
            end
          end
      end
    end
  end
end

.haltObject



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/vagrant-1cloud/actions.rb', line 127

def self.halt
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          if env[:force_halt]
            b.use PowerOff
          else
            b.use ShutDown
          end
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.already_off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.provisionObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/vagrant-1cloud/actions.rb', line 71

def self.provision
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          b.use Provision
          b.use ModifyProvisionPath
          b.use SyncedFolders
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.rebuildObject



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/vagrant-1cloud/actions.rb', line 164

def self.rebuild
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active, :off
          b.use Rebuild
          b.use PrivateNetwork
          b.use SetupSudo
          b.use SetupUser
          b.use provision
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.reloadObject



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/vagrant-1cloud/actions.rb', line 147

def self.reload
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          b.use Reload
          b.use provision
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.sshObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vagrant-1cloud/actions.rb', line 39

def self.ssh
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          b.use SSHExec
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.ssh_runObject



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/vagrant-1cloud/actions.rb', line 55

def self.ssh_run
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          b.use SSHRun
        when :off
          env[:ui].info I18n.t('vagrant_1cloud.info.off')
        when :not_created
          env[:ui].info I18n.t('vagrant_1cloud.info.not_created')
      end
    end
  end
end

.upObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/vagrant-1cloud/actions.rb', line 105

def self.up
  return Vagrant::Action::Builder.new.tap do |builder|
    builder.use ConfigValidate
    builder.use Call, CheckState do |env, b|
      case env[:machine_state]
        when :Active
          env[:ui].info I18n.t('vagrant_1cloud.info.already_active')
        when :off
          b.use PowerOn
          b.use provision
        when :not_created
          b.use SetupKey
          b.use Create
          b.use PrivateNetwork
          b.use SetupSudo
          b.use SetupUser
          b.use provision
      end
    end
  end
end