Module: VagrantPlugins::Abiquo::Actions

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-abiquo/actions.rb,
lib/vagrant-abiquo/actions/create.rb,
lib/vagrant-abiquo/actions/destroy.rb,
lib/vagrant-abiquo/actions/power_on.rb,
lib/vagrant-abiquo/actions/power_off.rb,
lib/vagrant-abiquo/actions/check_state.rb

Defined Under Namespace

Classes: CheckState, Create, Destroy, PowerOff, PowerOn

Class Method Summary collapse

Class Method Details

.destroyObject



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

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_abiquo.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



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

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
        b.use PowerOff
      when :off
        env[:ui].info I18n.t('vagrant_abiquo.info.already_off')
      when :not_created
        env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
      end
    end
  end
end

.provisionObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vagrant-abiquo/actions.rb', line 31

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 SyncFolders
      when :off
        env[:ui].info I18n.t('vagrant_abiquo.info.off')
      when :not_created
        env[:ui].info I18n.t('vagrant_abiquo.info.not_created')
      end
    end
  end
end

.upObject



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

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_abiquo.info.already_active')
      when :off
        b.use PowerOn
        b.use provision
      when :not_created
        b.use Create
        b.use provision
      end
    end
  end
end