Module: VagrantPlugins::QEMU::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-qemu/action.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/message_not_created.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: Destroy, Import, MessageAlreadyCreated, MessageNotCreated, MessageWillNotDestroy, PrepareForwardedPortCollisionParams, ReadState, StartInstance, StopInstance, WarnNetworks

Class Method Summary collapse

Class Method Details

.action_destroyObject

This action is called to terminate the remote machine.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/vagrant-qemu/action.rb', line 33

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.



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/vagrant-qemu/action.rb', line 18

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
# File 'lib/vagrant-qemu/action.rb', line 11

def self.action_package
  lambda do |env|
    raise Errors::NotSupportedError
  end
end

.action_provisionObject

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



57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/vagrant-qemu/action.rb', line 57

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.



74
75
76
77
78
79
# File 'lib/vagrant-qemu/action.rb', line 74

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

.action_reloadObject



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

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.



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/vagrant-qemu/action.rb', line 82

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



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

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



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/vagrant-qemu/action.rb', line 110

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 Provision
      b1.use EnvSet, port_collision_repair: false
      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.



133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/vagrant-qemu/action.rb', line 133

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