vagrant-arubacloud 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,23 @@
1
- VAGRANTFILE_API_VERSION = '2'
2
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
- end
5
-
6
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
- config.vm.box = "dummy"
8
- config.vm.define :vmvgr01 do |vmvgr01_config|
9
- vmvgr01_config.ssh.username = 'root'
10
- vmvgr01_config.ssh.password = 'test123'
11
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
13
- ac_override.nfs.functional = false # no nfs start
14
- ac.arubacloud_username = ENV['AC_USERNAME']
15
- ac.arubacloud_password = ENV['AC_PASSWORD']
16
- ac.service_type = 4
17
- ac.endpoint = "dc2"
18
- ac.template_id = '601'
19
- ac.server_name = 'lnxtestvag1'
20
- ac.package_id = 'small'
21
- end
22
- end
23
- end
1
+ VAGRANTFILE_API_VERSION = '2'
2
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
+ end
5
+
6
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
+ config.vm.box = "dummy"
8
+ config.vm.define :vmvgr01 do |vmvgr01_config|
9
+ vmvgr01_config.ssh.username = 'root'
10
+ vmvgr01_config.ssh.password = 'test123'
11
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
13
+ ac_override.nfs.functional = false # no nfs start
14
+ ac.arubacloud_username = ENV['AC_USERNAME']
15
+ ac.arubacloud_password = ENV['AC_PASSWORD']
16
+ ac.service_type = 4
17
+ ac.endpoint = "dc2"
18
+ ac.template_id = '601'
19
+ ac.server_name = 'lnxtestvag1'
20
+ ac.package_id = 'small'
21
+ end
22
+ end
23
+ end
@@ -1,108 +1,108 @@
1
- VAGRANTFILE_API_VERSION = '2'
2
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
- end
5
-
6
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
- config.vm.box = "dummy"
8
- config.vm.define :vmvgr01 do |vmvgr01_config|
9
- vmvgr01_config.ssh.username = 'root'
10
- vmvgr01_config.ssh.password = 'test123'
11
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
- vmvgr01_config.vm.provision "shell" do |s|
14
- s.inline = "echo 'test start script ok'"
15
- end
16
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
- ac_override.nfs.functional = false # no nfs start
18
- ac.arubacloud_username = ENV['AC_USERNAME']
19
- ac.arubacloud_password = ENV['AC_PASSWORD']
20
- ac.service_type = 4
21
- ac.endpoint = "dc2"
22
- ac.template_id = '601'
23
- ac.server_name = 'lnxtestvaga'
24
- ac.package_id = 'small'
25
- end
26
- end
27
- #
28
- config.vm.define :vmvgr02 do |vmvgr02_config|
29
- vmvgr02_config.ssh.username = 'root'
30
- vmvgr02_config.ssh.password = 'test123'
31
- vmvgr02_config.vm.synced_folder ".", "/vagrant", disabled: true
32
- vmvgr02_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
33
- vmvgr02_config.vm.provision "shell" do |s|
34
- s.inline = "echo 'test2 start script ok'"
35
- end
36
- vmvgr02_config.vm.provider :arubacloud do |ac, ac_override|
37
- ac_override.nfs.functional = false # no nfs start
38
- ac.arubacloud_username = ENV['AC_USERNAME']
39
- ac.arubacloud_password = ENV['AC_PASSWORD']
40
- ac.service_type = 4
41
- ac.endpoint = "dc2"
42
- ac.template_id = '601'
43
- ac.server_name = 'lnxtestvagb'
44
- ac.package_id = 'small'
45
- end
46
- end
47
- #
48
- config.vm.define :vmvgr03 do |vmvgr03_config|
49
- vmvgr03_config.ssh.username = 'root'
50
- vmvgr03_config.ssh.password = 'test123'
51
- vmvgr03_config.vm.synced_folder ".", "/vagrant", disabled: true
52
- vmvgr03_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
53
- vmvgr03_config.vm.provision "shell" do |s|
54
- s.inline = "echo 'test machine 3 start script ok'"
55
- end
56
- vmvgr03_config.vm.provider :arubacloud do |ac, ac_override|
57
- ac_override.nfs.functional = false # no nfs start
58
- ac.arubacloud_username = ENV['AC_USERNAME']
59
- ac.arubacloud_password = ENV['AC_PASSWORD']
60
- ac.service_type = 4
61
- ac.endpoint = "dc2"
62
- ac.template_id = '601'
63
- ac.server_name = 'lnxtestvagc'
64
- ac.package_id = 'small'
65
- end
66
- end
67
- #
68
- config.vm.define :vmvgr04 do |vmvgr04_config|
69
- vmvgr04_config.ssh.username = 'root'
70
- vmvgr04_config.ssh.password = 'test123'
71
- vmvgr04_config.vm.synced_folder ".", "/vagrant", disabled: true
72
- vmvgr04_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
73
- vmvgr04_config.vm.provision "shell" do |s|
74
- s.inline = "echo 'test machine 04 start script ok'"
75
- end
76
- vmvgr04_config.vm.provider :arubacloud do |ac, ac_override|
77
- ac_override.nfs.functional = false # no nfs start
78
- ac.arubacloud_username = ENV['AC_USERNAME']
79
- ac.arubacloud_password = ENV['AC_PASSWORD']
80
- ac.service_type = 4
81
- ac.endpoint = "dc2"
82
- ac.template_id = '601'
83
- ac.server_name = 'lnxtestvagd'
84
- ac.package_id = 'medium'
85
- end
86
- end
87
- #
88
- config.vm.define :vmvgr05 do |vmvgr05_config|
89
- vmvgr05_config.ssh.username = 'root'
90
- vmvgr05_config.ssh.password = 'test123'
91
- vmvgr05_config.vm.synced_folder ".", "/vagrant", disabled: true
92
- vmvgr05_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
93
- vmvgr05_config.vm.provision "shell" do |s|
94
- s.inline = "echo 'test machine 5 start script ok'"
95
- end
96
- vmvgr05_config.vm.provider :arubacloud do |ac, ac_override|
97
- ac_override.nfs.functional = false # no nfs start
98
- ac.arubacloud_username = ENV['AC_USERNAME']
99
- ac.arubacloud_password = ENV['AC_PASSWORD']
100
- ac.service_type = 4
101
- ac.endpoint = "dc2"
102
- ac.template_id = '601'
103
- ac.server_name = 'lnxtestvage'
104
- ac.package_id = 'small'
105
- end
106
- end
107
-
108
- end
1
+ VAGRANTFILE_API_VERSION = '2'
2
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
+ end
5
+
6
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
+ config.vm.box = "dummy"
8
+ config.vm.define :vmvgr01 do |vmvgr01_config|
9
+ vmvgr01_config.ssh.username = 'root'
10
+ vmvgr01_config.ssh.password = 'test123'
11
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
+ vmvgr01_config.vm.provision "shell" do |s|
14
+ s.inline = "echo 'test start script ok'"
15
+ end
16
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
+ ac_override.nfs.functional = false # no nfs start
18
+ ac.arubacloud_username = ENV['AC_USERNAME']
19
+ ac.arubacloud_password = ENV['AC_PASSWORD']
20
+ ac.service_type = 4
21
+ ac.endpoint = "dc2"
22
+ ac.template_id = '601'
23
+ ac.server_name = 'lnxtestvaga'
24
+ ac.package_id = 'small'
25
+ end
26
+ end
27
+ #
28
+ config.vm.define :vmvgr02 do |vmvgr02_config|
29
+ vmvgr02_config.ssh.username = 'root'
30
+ vmvgr02_config.ssh.password = 'test123'
31
+ vmvgr02_config.vm.synced_folder ".", "/vagrant", disabled: true
32
+ vmvgr02_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
33
+ vmvgr02_config.vm.provision "shell" do |s|
34
+ s.inline = "echo 'test2 start script ok'"
35
+ end
36
+ vmvgr02_config.vm.provider :arubacloud do |ac, ac_override|
37
+ ac_override.nfs.functional = false # no nfs start
38
+ ac.arubacloud_username = ENV['AC_USERNAME']
39
+ ac.arubacloud_password = ENV['AC_PASSWORD']
40
+ ac.service_type = 4
41
+ ac.endpoint = "dc2"
42
+ ac.template_id = '601'
43
+ ac.server_name = 'lnxtestvagb'
44
+ ac.package_id = 'small'
45
+ end
46
+ end
47
+ #
48
+ config.vm.define :vmvgr03 do |vmvgr03_config|
49
+ vmvgr03_config.ssh.username = 'root'
50
+ vmvgr03_config.ssh.password = 'test123'
51
+ vmvgr03_config.vm.synced_folder ".", "/vagrant", disabled: true
52
+ vmvgr03_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
53
+ vmvgr03_config.vm.provision "shell" do |s|
54
+ s.inline = "echo 'test machine 3 start script ok'"
55
+ end
56
+ vmvgr03_config.vm.provider :arubacloud do |ac, ac_override|
57
+ ac_override.nfs.functional = false # no nfs start
58
+ ac.arubacloud_username = ENV['AC_USERNAME']
59
+ ac.arubacloud_password = ENV['AC_PASSWORD']
60
+ ac.service_type = 4
61
+ ac.endpoint = "dc2"
62
+ ac.template_id = '601'
63
+ ac.server_name = 'lnxtestvagc'
64
+ ac.package_id = 'small'
65
+ end
66
+ end
67
+ #
68
+ config.vm.define :vmvgr04 do |vmvgr04_config|
69
+ vmvgr04_config.ssh.username = 'root'
70
+ vmvgr04_config.ssh.password = 'test123'
71
+ vmvgr04_config.vm.synced_folder ".", "/vagrant", disabled: true
72
+ vmvgr04_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
73
+ vmvgr04_config.vm.provision "shell" do |s|
74
+ s.inline = "echo 'test machine 04 start script ok'"
75
+ end
76
+ vmvgr04_config.vm.provider :arubacloud do |ac, ac_override|
77
+ ac_override.nfs.functional = false # no nfs start
78
+ ac.arubacloud_username = ENV['AC_USERNAME']
79
+ ac.arubacloud_password = ENV['AC_PASSWORD']
80
+ ac.service_type = 4
81
+ ac.endpoint = "dc2"
82
+ ac.template_id = '601'
83
+ ac.server_name = 'lnxtestvagd'
84
+ ac.package_id = 'medium'
85
+ end
86
+ end
87
+ #
88
+ config.vm.define :vmvgr05 do |vmvgr05_config|
89
+ vmvgr05_config.ssh.username = 'root'
90
+ vmvgr05_config.ssh.password = 'test123'
91
+ vmvgr05_config.vm.synced_folder ".", "/vagrant", disabled: true
92
+ vmvgr05_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
93
+ vmvgr05_config.vm.provision "shell" do |s|
94
+ s.inline = "echo 'test machine 5 start script ok'"
95
+ end
96
+ vmvgr05_config.vm.provider :arubacloud do |ac, ac_override|
97
+ ac_override.nfs.functional = false # no nfs start
98
+ ac.arubacloud_username = ENV['AC_USERNAME']
99
+ ac.arubacloud_password = ENV['AC_PASSWORD']
100
+ ac.service_type = 4
101
+ ac.endpoint = "dc2"
102
+ ac.template_id = '601'
103
+ ac.server_name = 'lnxtestvage'
104
+ ac.package_id = 'small'
105
+ end
106
+ end
107
+
108
+ end
@@ -1,22 +1,22 @@
1
- # -*- mode: ruby -*-
2
- # vi: set ft=ruby :
3
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
4
-
5
- VAGRANTFILE_API_VERSION = '2'
6
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
7
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
8
- end
9
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
- config.vm.box = "dummy"
11
- config.vm.define :vmvgr01 do |vmvgr01_config|
12
- vmvgr01_config.ssh.password = 'dummy'
13
- vmvgr01_config.vm.provider :arubacloud do |ac|
14
- ac.arubacloud_username = ENV['AC_USERNAME']
15
- ac.arubacloud_password = ENV['AC_PASSWORD']
16
- ac.service_type = 4
17
- ac.endpoint = "dc2"
18
- ac.template_id = 'dummy'
19
- ac.package_id = 'dummy'
20
- end
21
- end
22
- end
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
4
+
5
+ VAGRANTFILE_API_VERSION = '2'
6
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
7
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
8
+ end
9
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10
+ config.vm.box = "dummy"
11
+ config.vm.define :vmvgr01 do |vmvgr01_config|
12
+ vmvgr01_config.ssh.password = 'dummy'
13
+ vmvgr01_config.vm.provider :arubacloud do |ac|
14
+ ac.arubacloud_username = ENV['AC_USERNAME']
15
+ ac.arubacloud_password = ENV['AC_PASSWORD']
16
+ ac.service_type = 4
17
+ ac.endpoint = "dc2"
18
+ ac.template_id = 'dummy'
19
+ ac.package_id = 'dummy'
20
+ end
21
+ end
22
+ end
@@ -1,32 +1,32 @@
1
- VAGRANTFILE_API_VERSION = '2'
2
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
- end
5
-
6
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
- config.vm.box = "dummy"
8
- config.vm.define :vmvgr01 do |vmvgr01_config|
9
- vmvgr01_config.ssh.username = 'root'
10
- vmvgr01_config.ssh.password = 'test123'
11
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
- vmvgr01_config.vm.provision "shell" do |s|
14
- s.inline = "echo 'test start script ok'"
15
- end
16
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
- ac_override.nfs.functional = false # no nfs start
18
- ac.arubacloud_username = ENV['AC_USERNAME']
19
- ac.arubacloud_password = ENV['AC_PASSWORD']
20
- #
21
- ac.service_type = 2
22
- ac.endpoint = "dc2"
23
- ac.cpu_number = 2
24
- ac.ram_qty = 6
25
- ac.hds = [{:type => 0, :size => 20}, {:type => 1, :size => 30}]
26
- #
27
- # CentOS 7.x 64bit with pro VmWare
28
- ac.template_id = '691'
29
- ac.server_name = 'lnxprotstvag2'
30
- end
31
- end
32
- end
1
+ VAGRANTFILE_API_VERSION = '2'
2
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
+ end
5
+
6
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
+ config.vm.box = "dummy"
8
+ config.vm.define :vmvgr01 do |vmvgr01_config|
9
+ vmvgr01_config.ssh.username = 'root'
10
+ vmvgr01_config.ssh.password = 'test123'
11
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
+ vmvgr01_config.vm.provision "shell" do |s|
14
+ s.inline = "echo 'test start script ok'"
15
+ end
16
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
+ ac_override.nfs.functional = false # no nfs start
18
+ ac.arubacloud_username = ENV['AC_USERNAME']
19
+ ac.arubacloud_password = ENV['AC_PASSWORD']
20
+ #
21
+ ac.service_type = 2
22
+ ac.endpoint = "dc2"
23
+ ac.cpu_number = 2
24
+ ac.ram_qty = 6
25
+ ac.hds = [{:type => 0, :size => 20}, {:type => 1, :size => 30}]
26
+ #
27
+ # CentOS 7.x 64bit with pro VmWare
28
+ ac.template_id = '691'
29
+ ac.server_name = 'lnxprotstvag2'
30
+ end
31
+ end
32
+ end
@@ -1,27 +1,27 @@
1
- VAGRANTFILE_API_VERSION = '2'
2
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
- end
5
-
6
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
- config.vm.box = "dummy"
8
- config.vm.define :vmvgr01 do |vmvgr01_config|
9
- vmvgr01_config.ssh.username = 'root'
10
- vmvgr01_config.ssh.password = 'test123'
11
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
- vmvgr01_config.vm.provision "shell" do |s|
14
- s.inline = "echo 'test start script ok'"
15
- end
16
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
- ac_override.nfs.functional = false # no nfs start
18
- ac.arubacloud_username = ENV['AC_USERNAME']
19
- ac.arubacloud_password = ENV['AC_PASSWORD']
20
- ac.service_type = 4
21
- ac.endpoint = "dc2"
22
- ac.template_id = '601'
23
- ac.server_name = 'lnxtestvag1'
24
- ac.package_id = 'small'
25
- end
26
- end
27
- end
1
+ VAGRANTFILE_API_VERSION = '2'
2
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
3
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
4
+ end
5
+
6
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
+ config.vm.box = "dummy"
8
+ config.vm.define :vmvgr01 do |vmvgr01_config|
9
+ vmvgr01_config.ssh.username = 'root'
10
+ vmvgr01_config.ssh.password = 'test123'
11
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
12
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
13
+ vmvgr01_config.vm.provision "shell" do |s|
14
+ s.inline = "echo 'test start script ok'"
15
+ end
16
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
17
+ ac_override.nfs.functional = false # no nfs start
18
+ ac.arubacloud_username = ENV['AC_USERNAME']
19
+ ac.arubacloud_password = ENV['AC_PASSWORD']
20
+ ac.service_type = 4
21
+ ac.endpoint = "dc2"
22
+ ac.template_id = '601'
23
+ ac.server_name = 'lnxtestvag1'
24
+ ac.package_id = 'small'
25
+ end
26
+ end
27
+ end
@@ -1,204 +1,204 @@
1
- require 'vagrant/action/builder'
2
- require 'vagrant/action'
3
-
4
- module VagrantPlugins
5
- module ArubaCloud
6
- module Action
7
-
8
- # Access top level stuff
9
- include Vagrant::Action::Builtin
10
-
11
- def self.action_destroy
12
- Vagrant::Action::Builder.new.tap do |b|
13
- b.use ConfigValidate
14
- b.use Call, IsCreated do |env, b1|
15
- unless env[:result]
16
- b1.use MessageNotCreated
17
- next
18
- end
19
-
20
- b1.use Call, DestroyConfirm do |env1, b2|
21
- if env1[:result]
22
- b2.use ConnectArubaCloud
23
- b2.use HaltServer
24
- b2.use DeleteServer
25
- else
26
- b2.use Message, ' The server will not be deleted.'
27
- next
28
- end
29
- end
30
- end
31
- end
32
- end
33
-
34
- def self.action_halt
35
- Vagrant::Action::Builder.new.tap do |b|
36
- b.use ConfigValidate #shame on you
37
- b.use Call, IsCreated do |env, b1|
38
- unless env[:result]
39
- b1.use MessageNotCreated
40
- next
41
- end
42
- b1.use ConnectArubaCloud
43
- b1.use HaltServer
44
- end
45
- end
46
- end
47
-
48
- def self.action_start
49
- Vagrant::Action::Builder.new.tap do |b|
50
- b.use ConfigValidate
51
- b.use Call, IsCreated do |env, b1|
52
- unless env[:result]
53
- b1.use MessageNotCreated
54
- next
55
- end
56
- b1.use ConnectArubaCloud
57
- b1.use StartServer
58
- end
59
- end
60
- end
61
-
62
- def self.action_provision
63
- Vagrant::Action::Builder.new.tap do |b|
64
- b.use ConfigValidate
65
- b.use Call, IsCreated do |env, b2|
66
- unless env[:result]
67
- b2.use MessageNotCreated
68
- next
69
- end
70
- # Use our custom provisioning class
71
- b2.use ArubaProvision
72
- b2.use SyncedFolders
73
- end
74
- end
75
- end
76
-
77
- def self.action_reload
78
- Vagrant::Action::Builder.new.tap do |b|
79
- b.use ConfigValidate
80
- b.use ConnectArubaCloud
81
-
82
- b.use Call, IsCreated do |env, b2|
83
- if !env[:result]
84
- b2.use MessageNotCreated
85
- next
86
- end
87
- b2.use action_halt
88
- # if not stopped , signal and exit
89
- b2.use Call, IsState, Fog::ArubaCloud::Compute::Server::STOPPED do |envr, br|
90
- if !envr[:result]
91
- br.use Message, ' The server not respond at power off request.'
92
- next
93
- end
94
- end
95
- # VM is power off ; now can be powered on
96
- b2.use action_start
97
- b2.use Call, IsCreated do |env3, b3|
98
- unless env3[:result]
99
- b3.use Message, ' The server not re-create or not started '
100
- next
101
- end
102
- # Use our custom provisioning class
103
- b3.use ConnectArubaCloud
104
- b3.use WaitForCommunicator
105
- b3.use SyncedFolders
106
- end
107
- end
108
- end
109
- end
110
-
111
- def self.action_read_ssh_info
112
- Vagrant::Action::Builder.new.tap do |b|
113
- b.use ConfigValidate
114
- b.use ConnectArubaCloud
115
- b.use ReadSSHInfo
116
- end
117
- end
118
-
119
- # This action is called to read the state of the machine. The
120
- # resulting state is expected to be put into the `:machine_state_id`
121
- # key.
122
- def self.action_read_state
123
- Vagrant::Action::Builder.new.tap do |b|
124
- b.use ConfigValidate
125
- b.use ConnectArubaCloud
126
- b.use ReadState
127
- end
128
- end
129
-
130
- def self.action_ssh
131
- Vagrant::Action::Builder.new.tap do |b|
132
- b.use ConfigValidate
133
- b.use Call, IsCreated do |env, b2|
134
- unless env[:result]
135
- b2.use MessageNotCreated
136
- next
137
- end
138
- b2.use SSHExec
139
- end
140
- end
141
- end
142
-
143
- def self.action_ssh_run
144
- Vagrant::Action::Builder.new.tap do |b|
145
- b.use ConfigValidate
146
- b.use Call, IsCreated do |env, b2|
147
- unless env[:result]
148
- b2.use MessageNotCreated
149
- next
150
- end
151
-
152
- b2.use SSHRun
153
- end
154
- end
155
- end
156
-
157
- def self.action_up
158
- Vagrant::Action::Builder.new.tap do |b|
159
- b.use ConfigValidate
160
- b.use Call, IsCreated do |env, b2|
161
- if env[:result]
162
- b2.use MessageAlreadyCreated
163
- next
164
- end
165
- b2.use ConnectArubaCloud
166
- b2.use CreateServer
167
- b2.use WaitForCommunicator
168
- b2.use SyncedFolders
169
- end
170
- end
171
- end
172
-
173
- def self.action_list_servers
174
- Vagrant::Action::Builder.new.tap do |b|
175
- b.use ConnectArubaCloud
176
- b.use ListServers
177
- end
178
- end
179
-
180
- def self.action_list_templates
181
- Vagrant::Action::Builder.new.tap do |b|
182
- b.use ConnectArubaCloud
183
- b.use ListTemplates
184
- end
185
- end
186
-
187
- # The autoload farm
188
- action_root = Pathname.new(File.expand_path('../action', __FILE__))
189
- autoload :ConnectArubaCloud, action_root.join('connect_arubacloud')
190
- autoload :CreateServer, action_root.join('create_server')
191
- autoload :HaltServer, action_root.join('halt_server')
192
- autoload :StartServer, action_root.join('start_server')
193
- autoload :DeleteServer, action_root.join('delete_server')
194
- autoload :IsCreated, action_root.join('is_created')
195
- autoload :MessageNotCreated, action_root.join('message_not_created')
196
- autoload :MessageAlreadyCreated, action_root.join('message_already_created')
197
- autoload :ReadSSHInfo, action_root.join('read_ssh_info')
198
- autoload :ReadState, action_root.join('read_state')
199
- autoload :ListServers, action_root.join('list_servers')
200
- autoload :ListTemplates, action_root.join('list_templates')
201
- autoload :ArubaProvision, action_root.join('aruba_provision')
202
- end
203
- end
204
- end
1
+ require 'vagrant/action/builder'
2
+ require 'vagrant/action'
3
+
4
+ module VagrantPlugins
5
+ module ArubaCloud
6
+ module Action
7
+
8
+ # Access top level stuff
9
+ include Vagrant::Action::Builtin
10
+
11
+ def self.action_destroy
12
+ Vagrant::Action::Builder.new.tap do |b|
13
+ b.use ConfigValidate
14
+ b.use Call, IsCreated do |env, b1|
15
+ unless env[:result]
16
+ b1.use MessageNotCreated
17
+ next
18
+ end
19
+
20
+ b1.use Call, DestroyConfirm do |env1, b2|
21
+ if env1[:result]
22
+ b2.use ConnectArubaCloud
23
+ b2.use HaltServer
24
+ b2.use DeleteServer
25
+ else
26
+ b2.use Message, ' The server will not be deleted.'
27
+ next
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ def self.action_halt
35
+ Vagrant::Action::Builder.new.tap do |b|
36
+ b.use ConfigValidate #shame on you
37
+ b.use Call, IsCreated do |env, b1|
38
+ unless env[:result]
39
+ b1.use MessageNotCreated
40
+ next
41
+ end
42
+ b1.use ConnectArubaCloud
43
+ b1.use HaltServer
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.action_start
49
+ Vagrant::Action::Builder.new.tap do |b|
50
+ b.use ConfigValidate
51
+ b.use Call, IsCreated do |env, b1|
52
+ unless env[:result]
53
+ b1.use MessageNotCreated
54
+ next
55
+ end
56
+ b1.use ConnectArubaCloud
57
+ b1.use StartServer
58
+ end
59
+ end
60
+ end
61
+
62
+ def self.action_provision
63
+ Vagrant::Action::Builder.new.tap do |b|
64
+ b.use ConfigValidate
65
+ b.use Call, IsCreated do |env, b2|
66
+ unless env[:result]
67
+ b2.use MessageNotCreated
68
+ next
69
+ end
70
+ # Use our custom provisioning class
71
+ b2.use ArubaProvision
72
+ b2.use SyncedFolders
73
+ end
74
+ end
75
+ end
76
+
77
+ def self.action_reload
78
+ Vagrant::Action::Builder.new.tap do |b|
79
+ b.use ConfigValidate
80
+ b.use ConnectArubaCloud
81
+
82
+ b.use Call, IsCreated do |env, b2|
83
+ if !env[:result]
84
+ b2.use MessageNotCreated
85
+ next
86
+ end
87
+ b2.use action_halt
88
+ # if not stopped , signal and exit
89
+ b2.use Call, IsState, Fog::ArubaCloud::Compute::Server::STOPPED do |envr, br|
90
+ if !envr[:result]
91
+ br.use Message, ' The server not respond at power off request.'
92
+ next
93
+ end
94
+ end
95
+ # VM is power off ; now can be powered on
96
+ b2.use action_start
97
+ b2.use Call, IsCreated do |env3, b3|
98
+ unless env3[:result]
99
+ b3.use Message, ' The server not re-create or not started '
100
+ next
101
+ end
102
+ # Use our custom provisioning class
103
+ b3.use ConnectArubaCloud
104
+ b3.use WaitForCommunicator
105
+ b3.use SyncedFolders
106
+ end
107
+ end
108
+ end
109
+ end
110
+
111
+ def self.action_read_ssh_info
112
+ Vagrant::Action::Builder.new.tap do |b|
113
+ b.use ConfigValidate
114
+ b.use ConnectArubaCloud
115
+ b.use ReadSSHInfo
116
+ end
117
+ end
118
+
119
+ # This action is called to read the state of the machine. The
120
+ # resulting state is expected to be put into the `:machine_state_id`
121
+ # key.
122
+ def self.action_read_state
123
+ Vagrant::Action::Builder.new.tap do |b|
124
+ b.use ConfigValidate
125
+ b.use ConnectArubaCloud
126
+ b.use ReadState
127
+ end
128
+ end
129
+
130
+ def self.action_ssh
131
+ Vagrant::Action::Builder.new.tap do |b|
132
+ b.use ConfigValidate
133
+ b.use Call, IsCreated do |env, b2|
134
+ unless env[:result]
135
+ b2.use MessageNotCreated
136
+ next
137
+ end
138
+ b2.use SSHExec
139
+ end
140
+ end
141
+ end
142
+
143
+ def self.action_ssh_run
144
+ Vagrant::Action::Builder.new.tap do |b|
145
+ b.use ConfigValidate
146
+ b.use Call, IsCreated do |env, b2|
147
+ unless env[:result]
148
+ b2.use MessageNotCreated
149
+ next
150
+ end
151
+
152
+ b2.use SSHRun
153
+ end
154
+ end
155
+ end
156
+
157
+ def self.action_up
158
+ Vagrant::Action::Builder.new.tap do |b|
159
+ b.use ConfigValidate
160
+ b.use Call, IsCreated do |env, b2|
161
+ if env[:result]
162
+ b2.use MessageAlreadyCreated
163
+ next
164
+ end
165
+ b2.use ConnectArubaCloud
166
+ b2.use CreateServer
167
+ b2.use WaitForCommunicator
168
+ b2.use SyncedFolders
169
+ end
170
+ end
171
+ end
172
+
173
+ def self.action_list_servers
174
+ Vagrant::Action::Builder.new.tap do |b|
175
+ b.use ConnectArubaCloud
176
+ b.use ListServers
177
+ end
178
+ end
179
+
180
+ def self.action_list_templates
181
+ Vagrant::Action::Builder.new.tap do |b|
182
+ b.use ConnectArubaCloud
183
+ b.use ListTemplates
184
+ end
185
+ end
186
+
187
+ # The autoload farm
188
+ action_root = Pathname.new(File.expand_path('../action', __FILE__))
189
+ autoload :ConnectArubaCloud, action_root.join('connect_arubacloud')
190
+ autoload :CreateServer, action_root.join('create_server')
191
+ autoload :HaltServer, action_root.join('halt_server')
192
+ autoload :StartServer, action_root.join('start_server')
193
+ autoload :DeleteServer, action_root.join('delete_server')
194
+ autoload :IsCreated, action_root.join('is_created')
195
+ autoload :MessageNotCreated, action_root.join('message_not_created')
196
+ autoload :MessageAlreadyCreated, action_root.join('message_already_created')
197
+ autoload :ReadSSHInfo, action_root.join('read_ssh_info')
198
+ autoload :ReadState, action_root.join('read_state')
199
+ autoload :ListServers, action_root.join('list_servers')
200
+ autoload :ListTemplates, action_root.join('list_templates')
201
+ autoload :ArubaProvision, action_root.join('aruba_provision')
202
+ end
203
+ end
204
+ end