vagrant-subutai 1.1.3 → 1.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d85530987aa29ed8ea34ba2f14f62b0f353610b7
4
- data.tar.gz: e0052e2f1e16a49dacca29f63c93a257011a4bc4
3
+ metadata.gz: dbe4e42e53dfee5ad7d45eaf9aa495c2c69012e6
4
+ data.tar.gz: 8e01599337060878df7157e6f83ba695d43b5405
5
5
  SHA512:
6
- metadata.gz: 6eb58cb2f067c894be6d8746bffcefd2c74ee8113587e39e0763be00db480e1cd9a5393c6fb86fb9d27f7178f62e8d6ad4fb724ea6f35921245a39577a023801
7
- data.tar.gz: 84a85a6eddceed3ccb77df4577604e95159ff2504432b227eba8f7f39c0f72bfbeb527927e2932dc136c2d1c459469ab1e3ee2a537b5c946c77c2735116aaa63
6
+ metadata.gz: 164937201e9c9878ff768e72ec1216e6bf9e6b73ea6e77cf843aa3a22ad3bdc15eb0a8735a6c6c1633ddc0261b99b5ded675eeb59fbbde16b81ff44c14423eac
7
+ data.tar.gz: 6a219a6ab58ef9b22cd177574adfbcf380f2c0e6d2882d5cdf8cf7a434ffddf851f5135a3591b37421cd328bf28ad9a4b78484f2824291026ccad367fc5095e4
@@ -27,3 +27,9 @@ BUG FIXES:
27
27
  FEATURES:
28
28
 
29
29
  - VM Disk Path variable added to conf file (SUBUTAI_DISK_PATH)
30
+
31
+ ## 1.1.4 (March 30, 2018)
32
+
33
+ FEATURES:
34
+ - Libvirt disk size function added
35
+ - Cdn verfify certificate removed
@@ -1,6 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'digest'
3
- require 'net/http'
3
+ require 'net/https'
4
+ require 'uri'
4
5
  require 'json'
5
6
 
6
7
  require_relative 'subutai_net'
@@ -385,13 +386,26 @@ module SubutaiConfig
385
386
  # TODO remove Openssl verify (if certificate expired in cdn this code will be crashed)
386
387
  def self.get_latest_id_artifact(owner, artifact_name)
387
388
  url = url_of_cdn + '/raw/info?owner=' + owner + '&name=' + artifact_name
388
- uri = URI(url)
389
- response = Net::HTTP.get(uri)
390
- result = JSON.parse(response)
391
- result[0]['id']
389
+ uri = URI.parse(url)
390
+ https = Net::HTTP.new(uri.host, uri.port)
391
+ https.use_ssl = true
392
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
393
+ https.read_timeout = 3600 # an hour
394
+
395
+ request = Net::HTTP::Get.new(uri.request_uri)
396
+ response = https.request(request)
397
+
398
+ case response
399
+ when Net::HTTPOK
400
+ response = JSON.parse(response.body)
401
+ response[0]['id']
402
+ else
403
+ Put.error "Try again! #{response.body} template name #{name}, owner #{owner}"
404
+ end
392
405
  end
393
406
  end
394
407
 
395
408
  at_exit do
396
409
  SubutaiConfig.cleanup unless SubutaiConfig.cmd.nil?
397
410
  end
411
+
@@ -2,8 +2,8 @@ require_relative 'subutai_config'
2
2
 
3
3
  # For managing VM disks
4
4
  module SubutaiDisk
5
- DISK_NAME = "SubutaiDisk"
6
- DISK_FORMAT = "vdi"
5
+ DISK_NAME = "SubutaiDisk".freeze
6
+ DISK_FORMAT = "vdi".freeze
7
7
 
8
8
  # Checks disk size for adding new VM disks
9
9
  def self.has_grow
@@ -34,6 +34,11 @@ module SubutaiDisk
34
34
  grow_by.to_i * 1024 + 2 * 1024 # 2 gb for overhead, unit in megabytes
35
35
  end
36
36
 
37
+ def self.libvirt_size(grow_by)
38
+ size = grow_by.to_i + 2 # 2 gb for overhead, unit in gb
39
+ "#{size}G"
40
+ end
41
+
37
42
  # Save disk size and port to generated.yml
38
43
  def self.save_conf(grow_by)
39
44
  SubutaiConfig.put(:_DISK_PORT, port, true)
@@ -69,4 +74,18 @@ module SubutaiDisk
69
74
  end
70
75
  end
71
76
  end
77
+
78
+ def self.path
79
+ if File.directory?(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
80
+ # check permission
81
+ if File.writable?(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
82
+ File.join(SubutaiConfig.get(:SUBUTAI_DISK_PATH).to_s)
83
+ else
84
+ Put.warn "No write permission: #{SubutaiConfig.get(:SUBUTAI_DISK_PATH)}"
85
+ nil
86
+ end
87
+ else
88
+ nil
89
+ end
90
+ end
72
91
  end
@@ -10,6 +10,8 @@ module VagrantSubutai
10
10
  uri = URI.parse("#{url}?name=#{name}&owner=#{owner}")
11
11
  https = Net::HTTP.new(uri.host, uri.port)
12
12
  https.use_ssl = true
13
+ https.verify_mode = OpenSSL::SSL::VERIFY_NONE
14
+ https.read_timeout = 3600 # an hour
13
15
 
14
16
  request = Net::HTTP::Get.new(uri.request_uri)
15
17
  response = https.request(request)
@@ -37,4 +39,4 @@ module VagrantSubutai
37
39
  end
38
40
  end
39
41
  end
40
- end
42
+ end
@@ -136,8 +136,8 @@ module VagrantSubutai
136
136
  peer_id = Rest::SubutaiConsole.fingerprint(url)
137
137
  ip = info('ipaddr')
138
138
 
139
- Put.info ip
140
- Put.info peer_id
139
+ STDOUT.puts ip
140
+ STDOUT.puts peer_id
141
141
  rescue Net::OpenTimeout => e
142
142
  Put.error e
143
143
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module VagrantSubutai
2
- VERSION = '1.1.3'
2
+ VERSION = '1.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-subutai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Subutai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler