vagrant-subutai 1.1.7 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/vagrant-subutai/configs/configs.rb +1 -1
- data/lib/vagrant-subutai/packer/subutai_config.rb +3 -23
- data/lib/vagrant-subutai/packer/subutai_disk.rb +47 -0
- data/lib/vagrant-subutai/packer/subutai_hooks.rb +1 -13
- data/lib/vagrant-subutai/packer/subutai_net.rb +5 -5
- data/lib/vagrant-subutai/plugin.rb +4 -0
- data/lib/vagrant-subutai/registration.rb +70 -0
- data/lib/vagrant-subutai/subutai_commands.rb +63 -12
- data/lib/vagrant-subutai/version.rb +1 -1
- data/lib/vagrant-subutai.rb +1 -0
- data/test/subutai1.yaml +0 -1
- data/test/subutai2.yaml +0 -1
- data/test/subutai_config_test.rb +0 -66
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1ffa3b3284d337a4a95e72bc6d4646018dd918
|
4
|
+
data.tar.gz: 56d9b489baaba74456e6dc4805f9862aaf31e93d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a30ba866838451e1b6d5a6c5542a2d1cf9f549ca512ee1bb4591cd1455d8c887a2d9bb12de1681f79d5c45af75f66196ce15b73786c7aa179703f309e434c6af
|
7
|
+
data.tar.gz: 6c4720a5f36afabdca01cf0db9fdd32a110de9f8ad019f304ac063b759226bc2aee7e03b3f6f92c3c44fa353a642678956bcbac874065f18222d3af719a0cb45
|
data/CHANGELOG.md
CHANGED
@@ -51,4 +51,10 @@ BUG FIXES:
|
|
51
51
|
|
52
52
|
FEATURES:
|
53
53
|
- User configuration new keys added (LIBVIRT_USER, LIBVIRT_HOST, LIBVIRT_PORT, LIBVIRT_MACVTAP, LIBVIRT_NO_BRIDGE)
|
54
|
-
|
54
|
+
|
55
|
+
## 7.0.0. (May 9, 2018)
|
56
|
+
|
57
|
+
FEATURES:
|
58
|
+
- Support Vmware desktop and Parallels hypervisor
|
59
|
+
- Auto registration PeerOs to Bazaar
|
60
|
+
- User configuration new keys added (BAZAAR_NO_AUTO)
|
@@ -179,7 +179,7 @@ module VagrantSubutai
|
|
179
179
|
end
|
180
180
|
|
181
181
|
module SubutaiAgentCommand
|
182
|
-
BASE = 'sudo /
|
182
|
+
BASE = 'sudo /usr/bin/subutai'.freeze
|
183
183
|
UPDATE = ' update'.freeze # arg required
|
184
184
|
LOG = ' log'.freeze
|
185
185
|
INFO = ' info'.freeze # arg required
|
@@ -29,7 +29,6 @@ module SubutaiConfig
|
|
29
29
|
SUBUTAI_CPU
|
30
30
|
SUBUTAI_RAM
|
31
31
|
SUBUTAI_PEER
|
32
|
-
SUBUTAI_SNAP
|
33
32
|
SUBUTAI_DESKTOP
|
34
33
|
SUBUTAI_MAN_TMPL
|
35
34
|
APT_PROXY_URL
|
@@ -52,6 +51,7 @@ module SubutaiConfig
|
|
52
51
|
LIBVIRT_PORT
|
53
52
|
LIBVIRT_MACVTAP
|
54
53
|
LIBVIRT_NO_BRIDGE
|
54
|
+
BAZAAR_NO_AUTO
|
55
55
|
].freeze
|
56
56
|
|
57
57
|
GENERATED_PARAMETERS = %i[
|
@@ -60,9 +60,6 @@ module SubutaiConfig
|
|
60
60
|
_BASE_MAC
|
61
61
|
_SSH_PORT
|
62
62
|
_LOG_MODE
|
63
|
-
_ALT_SNAP
|
64
|
-
_ALT_SNAP_MD5
|
65
|
-
_ALT_SNAP_MD5_LAST
|
66
63
|
_ALT_MANAGEMENT
|
67
64
|
_ALT_MANAGEMENT_MD5
|
68
65
|
_ALT_MANAGEMENT_MD5_LAST
|
@@ -84,7 +81,7 @@ module SubutaiConfig
|
|
84
81
|
# Implemented configuration parameters
|
85
82
|
DESIRED_CONSOLE_PORT: 9999, # integer for console port
|
86
83
|
DESIRED_SSH_PORT: 4567, # integer for console port
|
87
|
-
ALLOW_INSECURE: false, # boolean to enable insecure CDN
|
84
|
+
ALLOW_INSECURE: false, # boolean to enable insecure CDN
|
88
85
|
SUBUTAI_ENV: :prod, # subutai environment to use
|
89
86
|
SUBUTAI_PEER: true, # to provision or not console (peer)
|
90
87
|
SUBUTAI_RAM: 4096, # RAM memory assigned to the vm
|
@@ -94,9 +91,9 @@ module SubutaiConfig
|
|
94
91
|
SUBUTAI_USERNAME: 'admin', # PeerOS default username
|
95
92
|
LIBVIRT_PORT: 22, # Libvirt kvm remote operation ssh port
|
96
93
|
LIBVIRT_MACVTAP: false, # Libvirt macvtap interface
|
94
|
+
BAZAAR_NO_AUTO: false, # PeerOs automatic registration to Bazaar (turn on(false), turn off(true))
|
97
95
|
|
98
96
|
# Configuration parameters below have not been implemented
|
99
|
-
SUBUTAI_SNAP: nil, # alternative snap to provision
|
100
97
|
SUBUTAI_DESKTOP: false, # install desktop with tray and p2p client
|
101
98
|
SUBUTAI_MAN_TMPL: nil, # provision alternative management template
|
102
99
|
APT_PROXY_URL: nil, # configure apt proxy URL
|
@@ -143,18 +140,6 @@ module SubutaiConfig
|
|
143
140
|
end
|
144
141
|
end
|
145
142
|
|
146
|
-
def self.provision_snap?
|
147
|
-
return false unless boolean?(:PROVISION)
|
148
|
-
return false if get(:_ALT_SNAP).nil?
|
149
|
-
return false if get(:_ALT_SNAP_MD5) == get(:_ALT_SNAP_MD5_LAST)
|
150
|
-
return false unless %w[up provision].include?(@cmd)
|
151
|
-
true
|
152
|
-
end
|
153
|
-
|
154
|
-
def self.snap_provisioned!
|
155
|
-
put(:_ALT_SNAP_MD5_LAST, get(:_ALT_SNAP_MD5), true) if provision_snap?
|
156
|
-
end
|
157
|
-
|
158
143
|
def self.bridged!
|
159
144
|
@bridged = true
|
160
145
|
end
|
@@ -299,11 +284,6 @@ module SubutaiConfig
|
|
299
284
|
|
300
285
|
def self.do_handlers
|
301
286
|
return false unless %w[up provision].include? @cmd
|
302
|
-
file = snap_handler(get(:SUBUTAI_SNAP))
|
303
|
-
unless file.nil?
|
304
|
-
put(:_ALT_SNAP, file, true) if provision_snap?
|
305
|
-
put(:_ALT_SNAP_MD5, Digest::MD5.file(file).to_s, true) if provision_snap?
|
306
|
-
end
|
307
287
|
|
308
288
|
file = management_handler(get(:SUBUTAI_MAN_TMPL))
|
309
289
|
unless file.nil?
|
@@ -4,6 +4,9 @@ require_relative 'subutai_config'
|
|
4
4
|
module SubutaiDisk
|
5
5
|
DISK_NAME = "SubutaiDisk".freeze
|
6
6
|
DISK_FORMAT = "vdi".freeze
|
7
|
+
DISK_FORMAT_VIRTUALBOX = "vdi".freeze
|
8
|
+
DISK_FORMAT_VMWARE = "vmdk".freeze
|
9
|
+
PROVIDER_VMWARE = "vmware".freeze
|
7
10
|
|
8
11
|
# Checks disk size for adding new VM disks
|
9
12
|
def self.has_grow
|
@@ -39,6 +42,20 @@ module SubutaiDisk
|
|
39
42
|
"#{size}G"
|
40
43
|
end
|
41
44
|
|
45
|
+
def self.vmware_size(grow_by)
|
46
|
+
grow_by.to_i + 2 # 2 gb for overhead, unit in gb
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.vmware_create_disk(grow_by, file_disk)
|
50
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
51
|
+
system("\"C:\\Program Files (x86)\\VMware\\VMware Workstation\\vmware-vdiskmanager.exe\" -c -s #{vmware_size(grow_by)}GB -a lsilogic -t 0 #{file_disk}")
|
52
|
+
elsif RbConfig::CONFIG['host_os'] =~ /darwin/
|
53
|
+
system("\"/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager\" -c -s #{vmware_size(grow_by)}GB -a lsilogic -t 0 #{file_disk}")
|
54
|
+
elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
|
55
|
+
system "vmware-vdiskmanager -c -s #{vmware_size(grow_by)}GB -a lsilogic -t 0 #{file_disk}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
42
59
|
# Save disk size and port to generated.yml
|
43
60
|
def self.save_conf(grow_by)
|
44
61
|
SubutaiConfig.put(:_DISK_PORT, port, true)
|
@@ -52,6 +69,8 @@ module SubutaiDisk
|
|
52
69
|
end
|
53
70
|
|
54
71
|
# Gives disk file name
|
72
|
+
# THIS IS FOR OLD VERSION BOXES
|
73
|
+
# UNDER <= v3.0.5
|
55
74
|
def self.file(grow_by)
|
56
75
|
disk_port = port
|
57
76
|
|
@@ -75,6 +94,34 @@ module SubutaiDisk
|
|
75
94
|
end
|
76
95
|
end
|
77
96
|
|
97
|
+
def self.file_path(grow_by, provider)
|
98
|
+
disk_port = port
|
99
|
+
disk_format = DISK_FORMAT
|
100
|
+
|
101
|
+
if provider == PROVIDER_VMWARE
|
102
|
+
disk_format = DISK_FORMAT_VMWARE
|
103
|
+
end
|
104
|
+
|
105
|
+
# get disk path from conf file
|
106
|
+
if SubutaiConfig.get(:SUBUTAI_DISK_PATH).nil?
|
107
|
+
File.join(Dir.pwd, "#{DISK_NAME}-#{disk_port.to_i}-#{grow_by}.#{disk_format}")
|
108
|
+
else
|
109
|
+
# Check is directory exist
|
110
|
+
if File.directory?(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
|
111
|
+
# check permission
|
112
|
+
if File.writable?(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
|
113
|
+
File.join(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s, "#{DISK_NAME}-#{disk_port.to_i}-#{grow_by}.#{disk_format}")
|
114
|
+
else
|
115
|
+
Put.warn "No write permission: #{SubutaiConfig.get(:SUBUTAI_DISK_PATH)}"
|
116
|
+
File.join(Dir.pwd, "#{DISK_NAME}-#{disk_port.to_i}-#{grow_by}.#{disk_format}")
|
117
|
+
end
|
118
|
+
else
|
119
|
+
Put.warn "Invalid path: #{SubutaiConfig.get(:SUBUTAI_DISK_PATH)}"
|
120
|
+
File.join(Dir.pwd, "#{DISK_NAME}-#{disk_port.to_i}-#{grow_by}.#{disk_format}")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
78
125
|
def self.path
|
79
126
|
if File.directory?(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
|
80
127
|
# check permission
|
@@ -15,7 +15,7 @@ end
|
|
15
15
|
def hook_handler(hook)
|
16
16
|
# hook might be the upload file or an executable to give the path to the
|
17
17
|
# file to be provisioned. Builders can use this to hook into the
|
18
|
-
# provisioning process for new
|
18
|
+
# provisioning process for new management templates.
|
19
19
|
unless File.executable?(hook)
|
20
20
|
puts '[WARNING] hook script ' + hook + ' not executable. Abandoning launch.'
|
21
21
|
return nil
|
@@ -35,18 +35,6 @@ end
|
|
35
35
|
# TODO: Match extension to OS and pick appropriately if
|
36
36
|
# both a .bat and .sh are present.
|
37
37
|
|
38
|
-
# If arg is nil check for presence of snap_hook.${ext}
|
39
|
-
# ----------------------------------------------------
|
40
|
-
def snap_handler(hook)
|
41
|
-
if hook.nil?
|
42
|
-
%w[.sh .bat].each do |e|
|
43
|
-
return hook_handler('./snap_hook' + e) if File.exist?('./snap_hook' + e)
|
44
|
-
end
|
45
|
-
return nil
|
46
|
-
end
|
47
|
-
hook_handler(hook)
|
48
|
-
end
|
49
|
-
|
50
38
|
# if arg is nil check for presence of management_hook.${ext}
|
51
39
|
# ----------------------------------------------------
|
52
40
|
def management_handler(hook)
|
@@ -33,7 +33,7 @@ PROVIDER_MAC_PREFIXES = {
|
|
33
33
|
:libvirt => '525400',
|
34
34
|
:vmware_fusion => '______',
|
35
35
|
:vmware => '005056',
|
36
|
-
:parallels => '
|
36
|
+
:parallels => '001c42',
|
37
37
|
:hyper_v => '______'
|
38
38
|
}
|
39
39
|
|
@@ -124,14 +124,14 @@ def random_mac_addr(provider)
|
|
124
124
|
when :libvirt
|
125
125
|
PROVIDER_MAC_PREFIXES[:libvirt] + 3.times.map { '%02x' % rand(0..255) }.join
|
126
126
|
when :vmware_fusion
|
127
|
-
|
128
|
-
raise "Unsupported provider #{provider}"
|
127
|
+
PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join
|
128
|
+
#raise "Unsupported provider #{provider}"
|
129
129
|
when :vmware
|
130
130
|
PROVIDER_MAC_PREFIXES[:vmware] + 3.times.map { '%02x' % rand(0..255) }.join
|
131
131
|
#raise "Unsupported provider #{provider}"
|
132
132
|
when :parallels
|
133
|
-
|
134
|
-
raise "Unsupported provider #{provider}"
|
133
|
+
PROVIDER_MAC_PREFIXES[:parallels] + 3.times.map { '%02x' % rand(0..255) }.join
|
134
|
+
#raise "Unsupported provider #{provider}"
|
135
135
|
when :hyper_v
|
136
136
|
# PROVIDER_MAC_PREFIXES[:hyper_v] + 3.times.map { '%02x' % rand(0..255) }.join
|
137
137
|
else
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require_relative '../vagrant-subutai'
|
2
|
+
|
3
|
+
|
4
|
+
module VagrantSubutai
|
5
|
+
class Registration < Vagrant.plugin(2, :provisioner)
|
6
|
+
attr_reader :machine
|
7
|
+
attr_reader :config
|
8
|
+
|
9
|
+
# Initializes the provisioner with the machine that it will be
|
10
|
+
# provisioning along with the provisioner configuration (if there
|
11
|
+
# is any).
|
12
|
+
#
|
13
|
+
# The provisioner should _not_ do anything at this point except
|
14
|
+
# initialize internal state.
|
15
|
+
#
|
16
|
+
# @param [Machine] machine The machine that this will be provisioning.
|
17
|
+
# @param [Object] config Provisioner configuration, if one was set.
|
18
|
+
def initialize(machine, config)
|
19
|
+
@machine = machine
|
20
|
+
@config = config
|
21
|
+
end
|
22
|
+
|
23
|
+
# Called with the root configuration of the machine so the provisioner
|
24
|
+
# can add some configuration on top of the machine.
|
25
|
+
#
|
26
|
+
# During this step, and this step only, the provisioner should modify
|
27
|
+
# the root machine configuration to add any additional features it
|
28
|
+
# may need. Examples include sharing folders, networking, and so on.
|
29
|
+
# This step is guaranteed to be called before any of those steps are
|
30
|
+
# done so the provisioner may do that.
|
31
|
+
#
|
32
|
+
# No return value is expected.
|
33
|
+
def configure(root_config)
|
34
|
+
end
|
35
|
+
|
36
|
+
# This is the method called when the actual provisioning should be
|
37
|
+
# done. The communicator is guaranteed to be ready at this point,
|
38
|
+
# and any shared folders or networks are already setup.
|
39
|
+
#
|
40
|
+
# No return value is expected.
|
41
|
+
def provision
|
42
|
+
if !SubutaiConfig.get(:BAZAAR_EMAIL).nil? && !SubutaiConfig.get(:BAZAAR_PASSWORD).nil? && !SubutaiConfig.get(:SUBUTAI_PASSWORD).nil?
|
43
|
+
|
44
|
+
unless SubutaiConfig.boolean?(:BAZAAR_NO_AUTO)
|
45
|
+
subutai_cli = Commands.new(ARGV, @machine.env)
|
46
|
+
ip = subutai_cli.info(Configs::VagrantCommand::ARG_IP_ADDR)
|
47
|
+
|
48
|
+
if ip.nil?
|
49
|
+
STDOUT.puts 'We can\'t detect your PeerOS ip address!'
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
|
53
|
+
url = "https://#{ip}:#{Configs::SubutaiConsoleAPI::PORT}"
|
54
|
+
|
55
|
+
if subutai_cli.is_management_ready?(url, 1)
|
56
|
+
unless subutai_cli.registered?(url)
|
57
|
+
subutai_cli.register(SubutaiConfig.get(:SUBUTAI_USERNAME), SubutaiConfig.get(:SUBUTAI_PASSWORD), url)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# This is the method called when destroying a machine that allows
|
65
|
+
# for any state related to the machine created by the provisioner
|
66
|
+
# to be cleaned up.
|
67
|
+
def cleanup
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -10,23 +10,13 @@ module VagrantSubutai
|
|
10
10
|
super(arg, env)
|
11
11
|
end
|
12
12
|
|
13
|
-
# show
|
13
|
+
# show logs
|
14
14
|
def log
|
15
15
|
ssh(base + Configs::SubutaiAgentCommand::LOG)
|
16
16
|
end
|
17
17
|
|
18
18
|
def base
|
19
|
-
|
20
|
-
|
21
|
-
if env.nil?
|
22
|
-
Configs::SubutaiAgentCommand::BASE
|
23
|
-
else
|
24
|
-
if env.to_s == 'prod'
|
25
|
-
Configs::SubutaiAgentCommand::BASE
|
26
|
-
else
|
27
|
-
"sudo /snap/bin/subutai-#{env.to_s}"
|
28
|
-
end
|
29
|
-
end
|
19
|
+
"sudo /usr/bin/subutai".freeze
|
30
20
|
end
|
31
21
|
|
32
22
|
# info id
|
@@ -132,6 +122,67 @@ module VagrantSubutai
|
|
132
122
|
end
|
133
123
|
end
|
134
124
|
|
125
|
+
# it will wait exponential time until management is ready
|
126
|
+
def is_management_ready?(url, attempt)
|
127
|
+
begin
|
128
|
+
response = Rest::SubutaiConsole.ready(url)
|
129
|
+
|
130
|
+
case response
|
131
|
+
when Net::HTTPOK # 200 Ready
|
132
|
+
return true
|
133
|
+
when response.code == 503
|
134
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
135
|
+
sleep(2**attempt) #
|
136
|
+
is_management_ready?(url, attempt+1)
|
137
|
+
end
|
138
|
+
when Net::HTTPNotFound
|
139
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
140
|
+
sleep(2**attempt) #
|
141
|
+
is_management_ready?(url, attempt+1)
|
142
|
+
end
|
143
|
+
when response.code == 500 # management happened something wrong
|
144
|
+
Put.error "PeerOS failed to run!"
|
145
|
+
return false
|
146
|
+
else
|
147
|
+
# PeerOs not ready
|
148
|
+
Put.error "PeerOS failed to run"
|
149
|
+
return false
|
150
|
+
end
|
151
|
+
rescue Net::OpenTimeout
|
152
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
153
|
+
sleep(2**attempt)
|
154
|
+
is_management_ready?(url, attempt+1)
|
155
|
+
end
|
156
|
+
rescue Errno::ECONNRESET
|
157
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
158
|
+
sleep(2**attempt) #
|
159
|
+
is_management_ready?(url, attempt+1)
|
160
|
+
end
|
161
|
+
rescue Errno::ECONNABORTED
|
162
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
163
|
+
sleep(2**attempt) #
|
164
|
+
is_management_ready?(url, attempt+1)
|
165
|
+
end
|
166
|
+
rescue OpenSSL::OpenSSLError # generic openssl error
|
167
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
168
|
+
sleep(2**attempt) #
|
169
|
+
is_management_ready?(url, attempt+1)
|
170
|
+
end
|
171
|
+
rescue OpenSSL::SSL::SSLError
|
172
|
+
if attempt < VagrantSubutai::Configs::Blueprint::ATTEMPT
|
173
|
+
sleep(2**attempt) #
|
174
|
+
is_management_ready?(url, attempt+1)
|
175
|
+
end
|
176
|
+
rescue => e
|
177
|
+
if attempt == 1 && ARGV[0] == 'up' # fails first attempt then try
|
178
|
+
sleep(10)
|
179
|
+
is_management_ready?(url, attempt+1)
|
180
|
+
else
|
181
|
+
return false
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
135
186
|
# register Subutai Peer Os to Bazaar by token
|
136
187
|
def register_by_token(token, url)
|
137
188
|
hub_email, hub_password, peer_name, peer_scope = get_input_register
|
data/lib/vagrant-subutai.rb
CHANGED
@@ -27,6 +27,7 @@ require 'vagrant-subutai/config'
|
|
27
27
|
require 'vagrant-subutai/plugin'
|
28
28
|
require 'vagrant-subutai/provisioner'
|
29
29
|
require 'vagrant-subutai/put'
|
30
|
+
require 'vagrant-subutai/registration'
|
30
31
|
require 'vagrant-subutai/subutai_commands'
|
31
32
|
require 'vagrant-subutai/version'
|
32
33
|
|
data/test/subutai1.yaml
CHANGED
data/test/subutai2.yaml
CHANGED
data/test/subutai_config_test.rb
CHANGED
@@ -37,7 +37,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
37
37
|
assert_equal(SubutaiConfig.get(:SUBUTAI_RAM), 4096)
|
38
38
|
assert_equal(SubutaiConfig.get(:SUBUTAI_CPU), 2)
|
39
39
|
|
40
|
-
assert_nil(SubutaiConfig.get(:SUBUTAI_SNAP))
|
41
40
|
assert_nil(SubutaiConfig.get(:SUBUTAI_MAN_TMPL))
|
42
41
|
assert_nil(SubutaiConfig.get(:APT_PROXY_URL))
|
43
42
|
|
@@ -157,13 +156,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
157
156
|
assert_equal(:prod, SubutaiConfig.get(:SUBUTAI_ENV))
|
158
157
|
assert_equal(:prod, SubutaiConfig.get('SUBUTAI_ENV'))
|
159
158
|
|
160
|
-
# SUBUTAI_SNAP
|
161
|
-
assert_nil(SubutaiConfig.get(:SUBUTAI_SNAP))
|
162
|
-
script = './bogus/path/script.sh'
|
163
|
-
assert_equal(script, SubutaiConfig.put(:SUBUTAI_SNAP, script, true))
|
164
|
-
assert_equal(script, SubutaiConfig.get(:SUBUTAI_SNAP))
|
165
|
-
assert_equal(script, SubutaiConfig.get('SUBUTAI_SNAP'))
|
166
|
-
|
167
159
|
# SUBUTAI_MAN_TMPL
|
168
160
|
assert_nil(SubutaiConfig.get(:SUBUTAI_MAN_TMPL))
|
169
161
|
pkg = './bogus/path/management.deb'
|
@@ -187,13 +179,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
187
179
|
assert_equal(1234, SubutaiConfig.get(:_CONSOLE_PORT))
|
188
180
|
assert_equal(1234, SubutaiConfig.get('_CONSOLE_PORT'))
|
189
181
|
|
190
|
-
# _ALT_SNAP
|
191
|
-
assert_nil(SubutaiConfig.get(:_ALT_SNAP))
|
192
|
-
snap = './bogus/path.snap'
|
193
|
-
assert_equal(snap, SubutaiConfig.put(:_ALT_SNAP, snap, true))
|
194
|
-
assert_equal(snap, SubutaiConfig.get(:_ALT_SNAP))
|
195
|
-
assert_equal(snap, SubutaiConfig.get('_ALT_SNAP'))
|
196
|
-
|
197
182
|
# _ALT_MANAGEMENT
|
198
183
|
assert_nil(SubutaiConfig.get(:_ALT_MANAGEMENT))
|
199
184
|
pkg = './bogus/path.deb'
|
@@ -214,9 +199,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
214
199
|
assert_equal(cmd, SubutaiConfig.cmd, 'cmd does not equal ' + cmd)
|
215
200
|
SubutaiConfig.put('SUBUTAI_PEER', true, true)
|
216
201
|
assert_path_exist(SubutaiConfig::GENERATED_FILE)
|
217
|
-
|
218
|
-
SubutaiConfig.put('SUBUTAI_SNAP', './bogus/path', true)
|
219
|
-
assert_equal('./bogus/path', SubutaiConfig.get('SUBUTAI_SNAP'))
|
220
202
|
end
|
221
203
|
|
222
204
|
def test_destroy
|
@@ -228,14 +210,11 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
228
210
|
def test_seq0
|
229
211
|
cmd = 'up'
|
230
212
|
pkg = './bogus/path/management.deb'
|
231
|
-
snap = './bogus/path.snap'
|
232
213
|
|
233
214
|
SubutaiConfig.load_config(cmd, :virtualbox)
|
234
215
|
assert_equal(cmd, SubutaiConfig.cmd, 'cmd does not equal ' + cmd)
|
235
|
-
assert_equal(snap, SubutaiConfig.put(:SUBUTAI_SNAP, snap, true))
|
236
216
|
assert_equal(pkg, SubutaiConfig.put(:SUBUTAI_MAN_TMPL, pkg, true))
|
237
217
|
assert_equal(1234, SubutaiConfig.put(:_CONSOLE_PORT, 1234, true))
|
238
|
-
assert_equal(snap, SubutaiConfig.put(:_ALT_SNAP, snap, true))
|
239
218
|
assert_equal(pkg, SubutaiConfig.put(:_ALT_MANAGEMENT, pkg, true))
|
240
219
|
assert_true(SubutaiConfig.put(:ALLOW_INSECURE, true, true))
|
241
220
|
assert_true(SubutaiConfig.put(:SUBUTAI_DESKTOP, true, true))
|
@@ -250,7 +229,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
250
229
|
cmd = 'ssh'
|
251
230
|
SubutaiConfig.load_config(cmd, :virtualbox)
|
252
231
|
assert_equal(cmd, SubutaiConfig.cmd, 'cmd does not equal ' + cmd)
|
253
|
-
assert_nil(SubutaiConfig.get(:SUBUTAI_SNAP))
|
254
232
|
assert_nil(SubutaiConfig.get(:SUBUTAI_MAN_TMPL))
|
255
233
|
assert_false(SubutaiConfig.get(:ALLOW_INSECURE))
|
256
234
|
assert_false(SubutaiConfig.get(:SUBUTAI_DESKTOP))
|
@@ -261,7 +239,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
261
239
|
assert_equal(:prod, SubutaiConfig.get(:SUBUTAI_ENV))
|
262
240
|
|
263
241
|
# these should not be cleared out by the reset
|
264
|
-
assert_equal(snap, SubutaiConfig.get(:_ALT_SNAP))
|
265
242
|
assert_equal(pkg, SubutaiConfig.get(:_ALT_MANAGEMENT))
|
266
243
|
|
267
244
|
cmd = 'suspend'
|
@@ -308,7 +285,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
308
285
|
assert_false(SubutaiConfig.get(:SUBUTAI_PEER))
|
309
286
|
assert_true(SubutaiConfig.get(:SUBUTAI_DESKTOP))
|
310
287
|
assert_true(SubutaiConfig.get(:ALLOW_INSECURE))
|
311
|
-
assert_equal('./foo/bar/bogus/path/to/shell/script.sh', SubutaiConfig.get(:SUBUTAI_SNAP))
|
312
288
|
assert_equal('./bar/foo/bogus/path/to/deb/pkg/management.deb', SubutaiConfig.get(:SUBUTAI_MAN_TMPL))
|
313
289
|
|
314
290
|
if ENV['APT_PROXY_URL'].nil?
|
@@ -322,7 +298,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
322
298
|
SubutaiConfig.load_config('up', :virtualbox)
|
323
299
|
assert_true(SubutaiConfig.boolean?(:SUBUTAI_PEER))
|
324
300
|
assert_false(SubutaiConfig.boolean?(:SUBUTAI_DESKTOP))
|
325
|
-
assert_false(SubutaiConfig.boolean?(:SUBUTAI_SNAP))
|
326
301
|
assert_raise do
|
327
302
|
SubutaiConfig.boolean?(:SUBUTAI_CPU)
|
328
303
|
end
|
@@ -345,45 +320,6 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
345
320
|
assert_true(SubutaiConfig.read?)
|
346
321
|
end
|
347
322
|
|
348
|
-
def test_provision_snap?
|
349
|
-
SubutaiConfig.load_config('ssh', :virtualbox)
|
350
|
-
configs = SubutaiConfig.config
|
351
|
-
|
352
|
-
# Make it all negative for provisioning conditions
|
353
|
-
configs.store(:PROVISION, false)
|
354
|
-
configs.store(:_ALT_SNAP, nil)
|
355
|
-
configs.store(:_ALT_SNAP_MD5, '6fc87ffd922973f8c88fd939fc091885')
|
356
|
-
configs.store(:_ALT_SNAP_MD5_LAST, '6fc87ffd922973f8c88fd939fc091885')
|
357
|
-
assert_false(SubutaiConfig.provision_snap?)
|
358
|
-
|
359
|
-
configs.store(:PROVISION, true)
|
360
|
-
configs.store(:_ALT_SNAP, nil)
|
361
|
-
configs.store(:_ALT_SNAP_MD5, '6fc87ffd922973f8c88fd939fc091885')
|
362
|
-
configs.store(:_ALT_SNAP_MD5_LAST, '6fc87ffd922973f8c88fd939fc091885')
|
363
|
-
assert_false(SubutaiConfig.provision_snap?)
|
364
|
-
|
365
|
-
configs.store(:PROVISION, true)
|
366
|
-
configs.store(:_ALT_SNAP, './ruby/tests/snap_script.sh')
|
367
|
-
configs.store(:_ALT_SNAP_MD5, '6fc87ffd922973f8c88fd939fc091885')
|
368
|
-
configs.store(:_ALT_SNAP_MD5_LAST, '6fc87ffd922973f8c88fd939fc091885')
|
369
|
-
assert_false(SubutaiConfig.provision_snap?)
|
370
|
-
|
371
|
-
configs.store(:PROVISION, true)
|
372
|
-
configs.store(:_ALT_SNAP, './ruby/tests/snap_script.sh')
|
373
|
-
configs.store(:_ALT_SNAP_MD5, '6fc87ffd922973f8c88fd939fc091885')
|
374
|
-
configs.store(:_ALT_SNAP_MD5_LAST, nil)
|
375
|
-
assert_false(SubutaiConfig.provision_snap?)
|
376
|
-
|
377
|
-
SubutaiConfig.load_config('provision', :virtualbox)
|
378
|
-
configs.store(:PROVISION, true)
|
379
|
-
configs.store(:_ALT_SNAP, './ruby/tests/snap_script.sh')
|
380
|
-
configs.store(:_ALT_SNAP_MD5, '6fc87ffd922973f8c88fd939fc091885')
|
381
|
-
configs.store(:_ALT_SNAP_MD5_LAST, nil)
|
382
|
-
assert_true(SubutaiConfig.provision_snap?)
|
383
|
-
|
384
|
-
SubutaiConfig.snap_provisioned!
|
385
|
-
end
|
386
|
-
|
387
323
|
def test_provision_management?
|
388
324
|
SubutaiConfig.load_config('ssh', :virtualbox)
|
389
325
|
configs = SubutaiConfig.config
|
@@ -432,11 +368,9 @@ class SubutaiConfigTest < Test::Unit::TestCase
|
|
432
368
|
assert_false(SubutaiConfig.do_handlers)
|
433
369
|
|
434
370
|
SubutaiConfig.load_config('up', :virtualbox)
|
435
|
-
configs.store(:SUBUTAI_SNAP, './ruby/tests/snap_script.sh')
|
436
371
|
configs.store(:SUBUTAI_MAN_TMPL, './ruby/tests/snap_script.sh')
|
437
372
|
assert_true(SubutaiConfig.do_handlers)
|
438
373
|
|
439
|
-
configs.store(:SUBUTAI_SNAP, './ruby/tests/bad_snap_script.sh')
|
440
374
|
configs.store(:SUBUTAI_MAN_TMPL, './ruby/tests/bad_snap_script.sh')
|
441
375
|
assert_raise do
|
442
376
|
SubutaiConfig.do_handlers
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-subutai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subutai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
description: Part of Subutai Tooling
|
@@ -44,7 +44,7 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
- .gitignore
|
47
|
+
- ".gitignore"
|
48
48
|
- CHANGELOG.md
|
49
49
|
- CODEOWNERS
|
50
50
|
- Gemfile
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/vagrant-subutai/plugin.rb
|
72
72
|
- lib/vagrant-subutai/provisioner.rb
|
73
73
|
- lib/vagrant-subutai/put.rb
|
74
|
+
- lib/vagrant-subutai/registration.rb
|
74
75
|
- lib/vagrant-subutai/rest/bazaar.rb
|
75
76
|
- lib/vagrant-subutai/rest/gorjun.rb
|
76
77
|
- lib/vagrant-subutai/rest/subutai_console.rb
|
@@ -98,17 +99,17 @@ require_paths:
|
|
98
99
|
- lib
|
99
100
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
101
|
requirements:
|
101
|
-
- -
|
102
|
+
- - ">="
|
102
103
|
- !ruby/object:Gem::Version
|
103
104
|
version: '0'
|
104
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
106
|
requirements:
|
106
|
-
- -
|
107
|
+
- - ">="
|
107
108
|
- !ruby/object:Gem::Version
|
108
109
|
version: '0'
|
109
110
|
requirements: []
|
110
111
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.6.14
|
112
113
|
signing_key:
|
113
114
|
specification_version: 4
|
114
115
|
summary: '["Subutai CLI. Execute subutai commands outside the Vagrant box"]'
|