Module: VagrantPlugins::QEMU::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-qemu/action.rb,
lib/vagrant-qemu/action/export.rb,
lib/vagrant-qemu/action/import.rb,
lib/vagrant-qemu/action/destroy.rb,
lib/vagrant-qemu/action/read_state.rb,
lib/vagrant-qemu/action/stop_instance.rb,
lib/vagrant-qemu/action/warn_networks.rb,
lib/vagrant-qemu/action/start_instance.rb,
lib/vagrant-qemu/action/cloud_init_network.rb,
lib/vagrant-qemu/action/message_not_created.rb,
lib/vagrant-qemu/action/package_vagrantfile.rb,
lib/vagrant-qemu/action/message_already_created.rb,
lib/vagrant-qemu/action/message_will_not_destroy.rb,
lib/vagrant-qemu/action/prepare_forwarded_port_collision_params.rb

Defined Under Namespace

Classes: CloudInitNetwork, Destroy, Export, Import, MessageAlreadyCreated, MessageNotCreated, MessageWillNotDestroy, PackageVagrantfile, PrepareForwardedPortCollisionParams, ReadState, StartInstance, StopInstance, WarnNetworks

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to terminate the remote machine.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/vagrant-qemu/action.rb', line 46

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use Call, DestroyConfirm do |env, b2|
      if env[:result]
        b2.use ConfigValidate
        b2.use Call, IsState, :not_created do |env2, b3|
          if env2[:result]
            b3.use MessageNotCreated
            next
          end

          b3.use ProvisionerCleanup, :before if defined?(ProvisionerCleanup)
          b3.use StopInstance
          b3.use Destroy
          b3.use SyncedFolderCleanup
        end
      else
        b2.use MessageWillNotDestroy
      end
    end
  end
end

.action_haltObject

This action is called to halt the remote machine.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vagrant-qemu/action.rb', line 31

def self.action_halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use StopInstance
    end
  end
end

.action_packageObject



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

def self.action_package
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Vagrant::Action::General::PackageSetupFolders
      b2.use Vagrant::Action::General::PackageSetupFiles
      b2.use StopInstance
      b2.use Vagrant::Action::General::Package
      b2.use Export
      b2.use PackageVagrantfile
    end
  end
end

.action_provisionObject

This action is called when vagrant provision is called.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/vagrant-qemu/action.rb', line 70

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use Provision
    end
  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_id key.



87
88
89
90
91
92
# File 'lib/vagrant-qemu/action.rb', line 87

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

.action_reloadObject



165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/vagrant-qemu/action.rb', line 165

def self.action_reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use action_halt
      b2.use action_start
    end
  end
end

.action_sshObject

This action is called to SSH into the machine.



95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/vagrant-qemu/action.rb', line 95

def self.action_ssh
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHExec
    end
  end
end

.action_ssh_runObject



109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/vagrant-qemu/action.rb', line 109

def self.action_ssh_run
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsState, :not_created do |env, b2|
      if env[:result]
        b2.use MessageNotCreated
        next
      end

      b2.use SSHRun
    end
  end
end

.action_startObject



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/vagrant-qemu/action.rb', line 123

def self.action_start
  Vagrant::Action::Builder.new.tap do |b|
    b.use Call, IsState, :running do |env1, b1|
      if env1[:result]
        b1.use action_provision
        next
      end

      b1.use CloudInitSetup
      b1.use CloudInitNetwork
      b1.use CleanupDisks
      b1.use Disk
      b1.use Provision
      b1.use EnvSet, port_collision_repair: true
      b1.use PrepareForwardedPortCollisionParams
      b1.use HandleForwardedPortCollisions
      b1.use SyncedFolderCleanup
      b1.use SyncedFolders
      b1.use WarnNetworks
      b1.use SetHostname
      b1.use StartInstance
      b1.use WaitForCommunicator, [:running]
    end
  end
end

.action_upObject

This action is called to bring the box up from nothing.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/vagrant-qemu/action.rb', line 150

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use HandleBox
    b.use ConfigValidate
    b.use BoxCheckOutdated
    b.use Call, IsState, :not_created do |env1, b1|
      if env1[:result]
        b1.use Import
      end

      b1.use action_start
    end
  end
end