Module: VagrantPlugins::Qubes::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-qubes/action.rb,
lib/vagrant-qubes/action/boot.rb,
lib/vagrant-qubes/action/halt.rb,
lib/vagrant-qubes/action/address.rb,
lib/vagrant-qubes/action/destroy.rb,
lib/vagrant-qubes/action/createvm.rb,
lib/vagrant-qubes/action/read_state.rb,
lib/vagrant-qubes/action/openfirewall.rb,
lib/vagrant-qubes/action/read_ssh_info.rb,
lib/vagrant-qubes/action/wait_for_state.rb

Overview

actions and how to run them

Defined Under Namespace

Classes: Address, Boot, CreateVM, Destroy, Halt, OpenFirewall, ReadSSHInfo, ReadState, WaitForState

Class Method Summary collapse

Class Method Details

.action_addressObject



15
16
17
18
19
# File 'lib/vagrant-qubes/action.rb', line 15

def self.action_address
  Vagrant::Action::Builder.new.tap do |b|
    b.use Address, false
  end
end

.action_address_multiObject



21
22
23
24
25
# File 'lib/vagrant-qubes/action.rb', line 21

def self.action_address_multi
  Vagrant::Action::Builder.new.tap do |b|
    b.use Address, true
  end
end

.action_destroyObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vagrant-qubes/action.rb', line 79

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use Call, ReadState do |env1, b1|
      b1.use ReadState
      if env1[:machine_state].to_s == 'not_created'
        env1[:ui].info I18n.t('vagrant_qubes.vagrant_qubes_message',
          message: 'Not destroying VM in state ' + env1[:machine_state].to_s)
      else
        b1.use Halt unless env1[:machine_state] == 'halted'
        b1.use ReadState
        b1.use Call, WaitForState, :halted, 240 do |env2, b2|
          b2.use ReadState
          if env2[:result] == 'True'
            b2.use Destroy
          end
        end
      end
    end
  end
end

.action_openfirewallObject



41
42
43
44
45
46
# File 'lib/vagrant-qubes/action.rb', line 41

def self.action_openfirewall
  Vagrant::Action::Builder.new.tap do |b|
    b.use ReadState
    b.use OpenFirewall
  end
end

.action_provisionObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/vagrant-qubes/action.rb', line 64

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ReadState
    b.use Call, WaitForState, :running, 240 do |env1, b1|
      if env1[:result] == 'True'
        b1.use ReadState
        b1.use Provision
        b1.use SyncedFolderCleanup
        b1.use SyncedFolders
        #b1.use SetHostname
      end
    end
  end
end

.action_read_ssh_infoObject



27
28
29
30
31
# File 'lib/vagrant-qubes/action.rb', line 27

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

.action_read_stateObject



9
10
11
12
13
# File 'lib/vagrant-qubes/action.rb', line 9

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

.action_sshObject



33
34
35
36
37
38
39
# File 'lib/vagrant-qubes/action.rb', line 33

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ReadState
    b.use ReadSSHInfo
    b.use SSHExec
  end
end

.action_upObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vagrant-qubes/action.rb', line 48

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ReadState
    b.use CreateVM
    b.use ReadState
    b.use Boot
    b.use Call, WaitForState, :running, 240 do |env1, b1|
      if env1[:result] == 'True'
        b1.use action_openfirewall
        b1.use action_provision
      end
    end
  end
end