Module: VagrantPlugins::VSphere::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vSphere/action.rb,
lib/vSphere/action/clone.rb,
lib/vSphere/action/destroy.rb,
lib/vSphere/action/power_on.rb,
lib/vSphere/action/get_state.rb,
lib/vSphere/action/power_off.rb,
lib/vSphere/action/is_created.rb,
lib/vSphere/action/is_running.rb,
lib/vSphere/action/get_ssh_info.rb,
lib/vSphere/action/close_vsphere.rb,
lib/vSphere/action/connect_vsphere.rb,
lib/vSphere/action/message_not_created.rb,
lib/vSphere/action/message_not_running.rb,
lib/vSphere/action/message_already_created.rb

Defined Under Namespace

Classes: Clone, CloseVSphere, ConnectVSphere, Destroy, GetSshInfo, GetState, IsCreated, IsRunning, MessageAlreadyCreated, MessageNotRunning, PowerOff, PowerOn

Class Method Summary collapse

Class Method Details

.action_destroyObject

Vagrant commands



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vSphere/action.rb', line 10

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use Call, IsRunning do |env, b2|
      if [:result]
          b2.use PowerOff
          next
      end
    end
    b.use Destroy
  end
end

.action_get_ssh_infoObject



146
147
148
149
150
151
152
153
# File 'lib/vSphere/action.rb', line 146

def self.action_get_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use GetSshInfo
    b.use CloseVSphere
  end
end

.action_get_stateObject

vSphere specific actions



137
138
139
140
141
142
143
144
# File 'lib/vSphere/action.rb', line 137

def self.action_get_state
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use GetState
    b.use CloseVSphere
  end
end

.action_haltObject



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/vSphere/action.rb', line 113

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

      b2.use Call, IsRunning do |env, b3|
        if !env[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use PowerOff
      end
    end
    b.use CloseVSphere
  end
end

.action_provisionObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/vSphere/action.rb', line 24

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

      b2.use Call, IsRunning do |env, b3|
        if !env[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use Provision
        b3.use SyncedFolders
      end
    end
  end
end

.action_sshObject



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

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

      b2.use Call, IsRunning do |env, b3|
        if !env[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use SSHExec
      end
    end
  end
end

.action_ssh_runObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vSphere/action.rb', line 67

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

      b2.use Call, IsRunning do |env, b3|
        if !env[:result]
          b3.use MessageNotRunning
          next
        end

        b3.use SSHRun
      end
    end
  end
end

.action_upObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/vSphere/action.rb', line 88

def self.action_up
  Vagrant::Action::Builder.new.tap do |b|
    b.use HandleBox
    b.use ConfigValidate
    b.use ConnectVSphere
    b.use Call, IsCreated do |env, b2|
      if env[:result]
        b2.use MessageAlreadyCreated
        next
      end

      b2.use Clone
    end
    b.use Call, IsRunning do |env, b2|
      if !env[:result]
        b2.use PowerOn
      end
    end
    b.use CloseVSphere
    b.use Provision
    b.use SyncedFolders
    b.use SetHostname
  end
end