Module: VagrantPlugins::ArubaCloud::Action

Includes:
Vagrant::Action::Builtin
Defined in:
lib/vagrant-arubacloud/action.rb,
lib/vagrant-arubacloud/action/is_created.rb,
lib/vagrant-arubacloud/action/read_state.rb,
lib/vagrant-arubacloud/action/halt_server.rb,
lib/vagrant-arubacloud/action/list_servers.rb,
lib/vagrant-arubacloud/action/start_server.rb,
lib/vagrant-arubacloud/action/create_server.rb,
lib/vagrant-arubacloud/action/delete_server.rb,
lib/vagrant-arubacloud/action/read_ssh_info.rb,
lib/vagrant-arubacloud/action/list_templates.rb,
lib/vagrant-arubacloud/action/aruba_provision.rb,
lib/vagrant-arubacloud/action/connect_arubacloud.rb,
lib/vagrant-arubacloud/action/disable_requiretty.rb,
lib/vagrant-arubacloud/action/message_not_created.rb,
lib/vagrant-arubacloud/action/message_already_created.rb

Defined Under Namespace

Classes: ArubaProvision, ConnectArubaCloud, CreateServer, DeleteServer, DisableRequireTty, HaltServer, IsCreated, ListServers, ListTemplates, MessageAlreadyCreated, MessageNotCreated, ReadSSHInfo, ReadState, StartServer

Class Method Summary collapse

Class Method Details

.action_destroyObject



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

def self.action_destroy
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b1|
      unless env[:result]
        b1.use MessageNotCreated
        next
      end

      b1.use Call, DestroyConfirm do |env1, b2|
        if env1[:result]
          b2.use ConnectArubaCloud
          b2.use HaltServer
          b2.use DeleteServer
        else
          b2.use Message, ' The server will not be deleted.'
          next
        end
      end
    end
  end
end

.action_haltObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vagrant-arubacloud/action.rb', line 34

def self.action_halt
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate #shame on you
    b.use Call, IsCreated do |env, b1|
      unless env[:result]
        b1.use MessageNotCreated
        next
      end
      b1.use ConnectArubaCloud
      b1.use HaltServer
    end
  end
end

.action_list_serversObject



173
174
175
176
177
178
# File 'lib/vagrant-arubacloud/action.rb', line 173

def self.action_list_servers
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConnectArubaCloud
    b.use ListServers
  end
end

.action_list_templatesObject



180
181
182
183
184
185
# File 'lib/vagrant-arubacloud/action.rb', line 180

def self.action_list_templates
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConnectArubaCloud
    b.use ListTemplates
  end
end

.action_provisionObject



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

def self.action_provision
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b2|
      unless env[:result]
        b2.use MessageNotCreated
        next
      end
      # Use our custom provisioning class
      b2.use ArubaProvision
      b2.use SyncedFolders
    end
  end
end

.action_read_ssh_infoObject



111
112
113
114
115
116
117
# File 'lib/vagrant-arubacloud/action.rb', line 111

def self.action_read_ssh_info
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectArubaCloud
    b.use ReadSSHInfo
  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.



122
123
124
125
126
127
128
# File 'lib/vagrant-arubacloud/action.rb', line 122

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

.action_reloadObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/vagrant-arubacloud/action.rb', line 77

def self.action_reload
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use ConnectArubaCloud

    b.use Call, IsCreated do |env, b2|
      if !env[:result]
        b2.use MessageNotCreated
        next
      end
      b2.use action_halt
      # if not stopped , signal and exit
	    b2.use Call, IsState, Fog::ArubaCloud::Compute::Server::STOPPED  do |envr, br|
 if !envr[:result]
          br.use Message, ' The server not respond at power off request.'
   next
 end
	    end
      # VM is power off ; now can be powered on
      b2.use action_start
      b2.use Call, IsCreated do |env3, b3|
        unless env3[:result]
          b3.use Message, ' The server not re-create or not started  '
          next
        end
        # Use our custom provisioning class
        b3.use ConnectArubaCloud
        b3.use WaitForCommunicator
        b3.use SyncedFolders
      end
    end
  end
end

.action_sshObject



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/vagrant-arubacloud/action.rb', line 130

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

.action_ssh_runObject



143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/vagrant-arubacloud/action.rb', line 143

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

      b2.use SSHRun
    end
  end
end

.action_startObject



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

def self.action_start
  Vagrant::Action::Builder.new.tap do |b|
    b.use ConfigValidate
    b.use Call, IsCreated do |env, b1|
      unless env[:result]
        b1.use MessageNotCreated
        next
      end
      b1.use ConnectArubaCloud
      b1.use StartServer
    end
  end
end

.action_upObject



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/vagrant-arubacloud/action.rb', line 157

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