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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -36
- data/Gemfile +12 -12
- data/LICENSE.txt +22 -22
- data/README.md +954 -954
- data/Vagrantfile_base +23 -23
- data/Vagrantfile_multi_machine +108 -108
- data/Vagrantfile_only_arubacloud_tmpl_srv +22 -22
- data/Vagrantfile_pro +32 -32
- data/Vagrantfile_syncing_and_sample_provision +27 -27
- data/lib/vagrant-arubacloud/action.rb +204 -204
- data/lib/vagrant-arubacloud/action/connect_arubacloud.rb +39 -39
- data/lib/vagrant-arubacloud/action/create_server.rb +116 -116
- data/lib/vagrant-arubacloud/action/delete_server.rb +35 -35
- data/lib/vagrant-arubacloud/action/halt_server.rb +61 -61
- data/lib/vagrant-arubacloud/action/list_servers.rb +61 -61
- data/lib/vagrant-arubacloud/action/list_templates.rb +36 -36
- data/lib/vagrant-arubacloud/action/read_ssh_info.rb +43 -43
- data/lib/vagrant-arubacloud/action/read_state.rb +43 -43
- data/lib/vagrant-arubacloud/action/start_server.rb +59 -59
- data/lib/vagrant-arubacloud/command/root.rb +66 -66
- data/lib/vagrant-arubacloud/command/servers.rb +49 -49
- data/lib/vagrant-arubacloud/command/snapshot.rb +175 -175
- data/lib/vagrant-arubacloud/config.rb +166 -167
- data/lib/vagrant-arubacloud/plugin.rb +56 -56
- data/lib/vagrant-arubacloud/provider.rb +51 -51
- data/lib/vagrant-arubacloud/version.rb +5 -5
- data/locales/en.yml +105 -105
- data/spec/vagrant-arubacloud/action_spec.rb +166 -166
- data/spec/vagrant-arubacloud/config_spec.rb +185 -185
- data/vagrant-arubacloud.gemspec +26 -27
- metadata +2 -16
@@ -1,167 +1,166 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
attr_accessor :
|
31
|
-
|
32
|
-
|
33
|
-
#
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
#
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
#
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
#
|
53
|
-
# '
|
54
|
-
# '
|
55
|
-
# 'large'
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#
|
69
|
-
# Pro
|
70
|
-
#
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
#
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
# Hd type 0
|
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
|
-
@
|
110
|
-
@
|
111
|
-
@
|
112
|
-
@
|
113
|
-
@
|
114
|
-
@
|
115
|
-
@
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
errors << I18n.t('vagrant_arubacloud.config.
|
124
|
-
errors << I18n.t('vagrant_arubacloud.config.
|
125
|
-
errors << I18n.t('vagrant_arubacloud.config.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
#
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
@
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
errors << I18n.t('vagrant_arubacloud.config.
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end # VagrantPlugins
|
1
|
+
require 'vagrant'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ArubaCloud
|
5
|
+
|
6
|
+
DC_TABLES = {
|
7
|
+
:dc1 => "https://api.dc1.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
8
|
+
:dc2 => "https://api.dc2.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
9
|
+
:dc3 => "https://api.dc3.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
10
|
+
:dc4 => "https://api.dc4.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
11
|
+
:dc5 => "https://api.dc5.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
12
|
+
:dc6 => "https://api.dc6.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json",
|
13
|
+
:dc8 => "https://api.dc8.computing.cloud.it/WsEndUser/v2.9/WsEndUser.svc/json"
|
14
|
+
}
|
15
|
+
|
16
|
+
DC_DEFAULT = "dc2"
|
17
|
+
|
18
|
+
class Config < Vagrant.plugin('2', :config)
|
19
|
+
|
20
|
+
# ArubaCloud Username
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :arubacloud_username
|
23
|
+
|
24
|
+
# ArubaCloud Password
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :arubacloud_password
|
27
|
+
|
28
|
+
# reserved for internal use
|
29
|
+
attr_accessor :reserved_status
|
30
|
+
attr_accessor :reserved_list_owned
|
31
|
+
|
32
|
+
# Ws EndPoint Url
|
33
|
+
# Expected to be the url of the web service to use
|
34
|
+
# @return [String]
|
35
|
+
attr_accessor :url
|
36
|
+
|
37
|
+
# Ws EndPoint id : can be dc2,dc2,dc3,...dc8 (dc7 is not defined at this release)
|
38
|
+
# @return [String]
|
39
|
+
attr_accessor :endpoint
|
40
|
+
|
41
|
+
# The name of the server. This defaults to the name of the machine
|
42
|
+
# defined by Vagrant (via 'config.vm.define'), but can be override here.
|
43
|
+
# @return [String]
|
44
|
+
attr_accessor :server_name
|
45
|
+
|
46
|
+
# The ID of the template to use, use vagrant arubacloud templates to obtain
|
47
|
+
# the complete list.
|
48
|
+
# @return [Integer]
|
49
|
+
attr_accessor :template_id
|
50
|
+
|
51
|
+
# The smart vm type expressed as String:
|
52
|
+
# 'small'
|
53
|
+
# 'medium'
|
54
|
+
# 'large'
|
55
|
+
# 'extra large'
|
56
|
+
# @return [String]
|
57
|
+
attr_accessor :package_id
|
58
|
+
|
59
|
+
# Service Type expressed in ID [Integer]:
|
60
|
+
# 1 = Pro Hyper-V
|
61
|
+
# 2 = Pro VMWare
|
62
|
+
# 3 = Pro Hyper-V Low Cost
|
63
|
+
# 4 = Smart
|
64
|
+
# @return [Integer]
|
65
|
+
attr_accessor :service_type
|
66
|
+
|
67
|
+
# Number of Virtual CPU to be assigned to the VM
|
68
|
+
# Pro VMWare: 1 < n < 8
|
69
|
+
# Pro Hyper-V: 1 < n < 4
|
70
|
+
# @return [Integer]
|
71
|
+
attr_accessor :cpu_number
|
72
|
+
|
73
|
+
# Amount of GB of RAM to be assigned to the VM
|
74
|
+
# n <= 16
|
75
|
+
# @return [Integer]
|
76
|
+
attr_accessor :ram_qty
|
77
|
+
|
78
|
+
# Array containing hard disk Configuration
|
79
|
+
# Example configuration (size is expressed in GB):
|
80
|
+
# Hds = [{:type => 0, :size => 100}, {:type => 1, :size => 200}]
|
81
|
+
# Hd type 0 is required because specify the first hard disk, max size per hd: 500 GB
|
82
|
+
# Hd type > 0 < 4 are 3 additional hard disks (optional)
|
83
|
+
# @return [Array]
|
84
|
+
attr_accessor :hds
|
85
|
+
|
86
|
+
def initialize
|
87
|
+
@arubacloud_username = UNSET_VALUE
|
88
|
+
@arubacloud_password = UNSET_VALUE
|
89
|
+
@url = UNSET_VALUE
|
90
|
+
@reserved_status = UNSET_VALUE
|
91
|
+
@reserved_list_owned = UNSET_VALUE
|
92
|
+
@endpoint = UNSET_VALUE
|
93
|
+
@server_name = UNSET_VALUE
|
94
|
+
@template_id = UNSET_VALUE
|
95
|
+
@package_id = UNSET_VALUE
|
96
|
+
@service_type = UNSET_VALUE
|
97
|
+
@cpu_number = UNSET_VALUE
|
98
|
+
@ram_qty = UNSET_VALUE
|
99
|
+
@hds = UNSET_VALUE
|
100
|
+
end
|
101
|
+
|
102
|
+
def finalize!
|
103
|
+
@arubacloud_username = nil if @arubacloud_username == UNSET_VALUE
|
104
|
+
@arubacloud_password = nil if @arubacloud_password == UNSET_VALUE
|
105
|
+
@url = nil if @url == UNSET_VALUE
|
106
|
+
@reserved_status = nil if @reserved_status = UNSET_VALUE
|
107
|
+
@reserved_list_owned = nil if @reserved_list_owned = UNSET_VALUE
|
108
|
+
@endpoint = nil if @endpoint == UNSET_VALUE
|
109
|
+
@server_name = nil if @server_name == UNSET_VALUE
|
110
|
+
@template_id = nil if @template_id == UNSET_VALUE
|
111
|
+
@package_id = nil if @package_id == UNSET_VALUE
|
112
|
+
@service_type = nil if @service_type == UNSET_VALUE
|
113
|
+
@cpu_number = nil if @cpu_number == UNSET_VALUE
|
114
|
+
@ram_qty = nil if @ram_qty == UNSET_VALUE
|
115
|
+
@hds = nil if @hds == UNSET_VALUE
|
116
|
+
end
|
117
|
+
|
118
|
+
def validate(machine)
|
119
|
+
errors = _detected_errors
|
120
|
+
|
121
|
+
# Global configurations needed by all service types
|
122
|
+
errors << I18n.t('vagrant_arubacloud.config.arubacloud_username_required') unless @arubacloud_username
|
123
|
+
errors << I18n.t('vagrant_arubacloud.config.arubacloud_password_required') unless @arubacloud_password
|
124
|
+
errors << I18n.t('vagrant_arubacloud.config.template_id_required') unless @template_id
|
125
|
+
errors << I18n.t('vagrant_arubacloud.config.service_type_required') unless @service_type
|
126
|
+
|
127
|
+
errors << I18n.t('vagrant_arubacloud.config.ssh_password_required') unless machine.config.ssh.password
|
128
|
+
|
129
|
+
#check if coded url or endpoint
|
130
|
+
#if url not in table or dc wrong return error
|
131
|
+
if (@url)
|
132
|
+
if (DC_TABLES.key(@url))
|
133
|
+
@endpoint = DC_TABLES.key(@url)
|
134
|
+
else
|
135
|
+
errors << I18n.t('vagrant_arubacloud.config.url_is_wrong')
|
136
|
+
end
|
137
|
+
else
|
138
|
+
if (@endpoint)
|
139
|
+
if DC_TABLES.key?(@endpoint.to_sym)
|
140
|
+
@url = DC_TABLES[@endpoint.to_sym]
|
141
|
+
else
|
142
|
+
errors << I18n.t('vagrant_arubacloud.config.endpoint_is_wrong')
|
143
|
+
end
|
144
|
+
else
|
145
|
+
@endpoint = DC_DEFAULT.to_sym
|
146
|
+
@url = DC_TABLES[DC_DEFAULT.to_sym]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
if @service_type.eql? 4
|
151
|
+
errors << I18n.t('vagrant_arubacloud.config.package_id_required') unless @package_id
|
152
|
+
else
|
153
|
+
errors << I18n.t('vagrant_arubacloud.config.cpu_number_required') unless @cpu_number
|
154
|
+
errors << I18n.t('vagrant_arubacloud.config.ram_qty_required') unless @ram_qty
|
155
|
+
if @hds
|
156
|
+
errors << I18n.t('vagrant_arubacloud.config.hds_conf_must_be_array') unless @hds.kind_of?(Array)
|
157
|
+
elsif
|
158
|
+
errors << I18n.t('vagrant_arubacloud.config.hds_conf_required')
|
159
|
+
end
|
160
|
+
end
|
161
|
+
{'ArubaCloud Provider' => errors}
|
162
|
+
end
|
163
|
+
end # Config
|
164
|
+
|
165
|
+
end # ArubaCloud
|
166
|
+
end # VagrantPlugins
|
@@ -1,56 +1,56 @@
|
|
1
|
-
begin
|
2
|
-
require 'vagrant'
|
3
|
-
rescue LoadError
|
4
|
-
raise 'The ArubaCloud IaaS provider must be run within Vagrant.'
|
5
|
-
end
|
6
|
-
|
7
|
-
if Vagrant::VERSION < '1.2.0'
|
8
|
-
raise 'ArubaCloud IaaS provider is only compatible with Vagrant 1.2+'
|
9
|
-
end
|
10
|
-
|
11
|
-
module VagrantPlugins
|
12
|
-
module ArubaCloud
|
13
|
-
class Plugin < Vagrant.plugin('2')
|
14
|
-
# noinspection RubyArgCount
|
15
|
-
name 'ArubaCloud'
|
16
|
-
description <<-DESC
|
17
|
-
This plugin enable Vagrant to manage machines in ArubaCloud IaaS service.
|
18
|
-
DESC
|
19
|
-
|
20
|
-
config(:arubacloud, :provider) do
|
21
|
-
require_relative 'config'
|
22
|
-
Config
|
23
|
-
end
|
24
|
-
|
25
|
-
provider(:arubacloud, { :box_optional => true, :parallel => true }) do
|
26
|
-
ArubaCloud.init_i18n
|
27
|
-
ArubaCloud.init_logging
|
28
|
-
|
29
|
-
require_relative 'provider'
|
30
|
-
Provider
|
31
|
-
end
|
32
|
-
|
33
|
-
command('arubacloud') do
|
34
|
-
ArubaCloud.init_i18n
|
35
|
-
ArubaCloud.init_logging
|
36
|
-
|
37
|
-
require_relative 'command/root'
|
38
|
-
Command::Root
|
39
|
-
end
|
40
|
-
|
41
|
-
command('snapshot') do
|
42
|
-
ArubaCloud.init_i18n
|
43
|
-
ArubaCloud.init_logging
|
44
|
-
|
45
|
-
require_relative 'command/snapshot'
|
46
|
-
Command::Snapshot
|
47
|
-
end
|
48
|
-
|
49
|
-
# Disable require tty for centOS
|
50
|
-
guest_capability 'redhat', 'disable_requiretty' do
|
51
|
-
require_relative 'cap/disable_requiretty'
|
52
|
-
Cap::DisableRequireTty
|
53
|
-
end
|
54
|
-
end # Plugin
|
55
|
-
end # ArubaCloud
|
56
|
-
end # VagrantPlugins
|
1
|
+
begin
|
2
|
+
require 'vagrant'
|
3
|
+
rescue LoadError
|
4
|
+
raise 'The ArubaCloud IaaS provider must be run within Vagrant.'
|
5
|
+
end
|
6
|
+
|
7
|
+
if Vagrant::VERSION < '1.2.0'
|
8
|
+
raise 'ArubaCloud IaaS provider is only compatible with Vagrant 1.2+'
|
9
|
+
end
|
10
|
+
|
11
|
+
module VagrantPlugins
|
12
|
+
module ArubaCloud
|
13
|
+
class Plugin < Vagrant.plugin('2')
|
14
|
+
# noinspection RubyArgCount
|
15
|
+
name 'ArubaCloud'
|
16
|
+
description <<-DESC
|
17
|
+
This plugin enable Vagrant to manage machines in ArubaCloud IaaS service.
|
18
|
+
DESC
|
19
|
+
|
20
|
+
config(:arubacloud, :provider) do
|
21
|
+
require_relative 'config'
|
22
|
+
Config
|
23
|
+
end
|
24
|
+
|
25
|
+
provider(:arubacloud, { :box_optional => true, :parallel => true }) do
|
26
|
+
ArubaCloud.init_i18n
|
27
|
+
ArubaCloud.init_logging
|
28
|
+
|
29
|
+
require_relative 'provider'
|
30
|
+
Provider
|
31
|
+
end
|
32
|
+
|
33
|
+
command('arubacloud') do
|
34
|
+
ArubaCloud.init_i18n
|
35
|
+
ArubaCloud.init_logging
|
36
|
+
|
37
|
+
require_relative 'command/root'
|
38
|
+
Command::Root
|
39
|
+
end
|
40
|
+
|
41
|
+
command('snapshot') do
|
42
|
+
ArubaCloud.init_i18n
|
43
|
+
ArubaCloud.init_logging
|
44
|
+
|
45
|
+
require_relative 'command/snapshot'
|
46
|
+
Command::Snapshot
|
47
|
+
end
|
48
|
+
|
49
|
+
# Disable require tty for centOS
|
50
|
+
guest_capability 'redhat', 'disable_requiretty' do
|
51
|
+
require_relative 'cap/disable_requiretty'
|
52
|
+
Cap::DisableRequireTty
|
53
|
+
end
|
54
|
+
end # Plugin
|
55
|
+
end # ArubaCloud
|
56
|
+
end # VagrantPlugins
|
@@ -1,51 +1,51 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
|
3
|
-
require 'vagrant-arubacloud/action'
|
4
|
-
|
5
|
-
|
6
|
-
module VagrantPlugins
|
7
|
-
module ArubaCloud
|
8
|
-
class Provider < Vagrant.plugin('2', :provider)
|
9
|
-
def initialize(machine)
|
10
|
-
@machine = machine
|
11
|
-
end
|
12
|
-
|
13
|
-
def action(name)
|
14
|
-
# Attempt to get the action method from the Action class if it
|
15
|
-
# exists, otherwise return nil to show that we don't support the
|
16
|
-
# given action.
|
17
|
-
action_method = "action_#{name}"
|
18
|
-
return Action.send(action_method) if Action.respond_to?(action_method)
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def ssh_info
|
23
|
-
# Run a custom action called "read_ssh_info" which does what it
|
24
|
-
# says and puts the resulting SSH info into the `:machine_ssh_info`
|
25
|
-
# key in the environment.
|
26
|
-
env = @machine.action("read_ssh_info")
|
27
|
-
env[:machine_ssh_info]
|
28
|
-
end
|
29
|
-
|
30
|
-
def state
|
31
|
-
# Run a custom action we define called "read_state" which does
|
32
|
-
# what it says. It puts the state in the `:machine_state_id`
|
33
|
-
# key in the environment.
|
34
|
-
env = @machine.action('read_state')
|
35
|
-
|
36
|
-
state_id = env[:machine_state_id]
|
37
|
-
|
38
|
-
# Get the short and long description
|
39
|
-
short = I18n.t("vagrant_arubacloud.states.short_#{state_id}")
|
40
|
-
long = I18n.t("vagrant_arubacloud.states.long_#{state_id}")
|
41
|
-
|
42
|
-
# Return the MachineState object
|
43
|
-
Vagrant::MachineState.new(state_id, short, long)
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_s
|
47
|
-
'ArubaCloud IaaS'
|
48
|
-
end
|
49
|
-
end # Provider
|
50
|
-
end # ArubaCloud
|
51
|
-
end # VagrantPlugins
|
1
|
+
require 'vagrant'
|
2
|
+
|
3
|
+
require 'vagrant-arubacloud/action'
|
4
|
+
|
5
|
+
|
6
|
+
module VagrantPlugins
|
7
|
+
module ArubaCloud
|
8
|
+
class Provider < Vagrant.plugin('2', :provider)
|
9
|
+
def initialize(machine)
|
10
|
+
@machine = machine
|
11
|
+
end
|
12
|
+
|
13
|
+
def action(name)
|
14
|
+
# Attempt to get the action method from the Action class if it
|
15
|
+
# exists, otherwise return nil to show that we don't support the
|
16
|
+
# given action.
|
17
|
+
action_method = "action_#{name}"
|
18
|
+
return Action.send(action_method) if Action.respond_to?(action_method)
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def ssh_info
|
23
|
+
# Run a custom action called "read_ssh_info" which does what it
|
24
|
+
# says and puts the resulting SSH info into the `:machine_ssh_info`
|
25
|
+
# key in the environment.
|
26
|
+
env = @machine.action("read_ssh_info")
|
27
|
+
env[:machine_ssh_info]
|
28
|
+
end
|
29
|
+
|
30
|
+
def state
|
31
|
+
# Run a custom action we define called "read_state" which does
|
32
|
+
# what it says. It puts the state in the `:machine_state_id`
|
33
|
+
# key in the environment.
|
34
|
+
env = @machine.action('read_state')
|
35
|
+
|
36
|
+
state_id = env[:machine_state_id]
|
37
|
+
|
38
|
+
# Get the short and long description
|
39
|
+
short = I18n.t("vagrant_arubacloud.states.short_#{state_id}")
|
40
|
+
long = I18n.t("vagrant_arubacloud.states.long_#{state_id}")
|
41
|
+
|
42
|
+
# Return the MachineState object
|
43
|
+
Vagrant::MachineState.new(state_id, short, long)
|
44
|
+
end
|
45
|
+
|
46
|
+
def to_s
|
47
|
+
'ArubaCloud IaaS'
|
48
|
+
end
|
49
|
+
end # Provider
|
50
|
+
end # ArubaCloud
|
51
|
+
end # VagrantPlugins
|