vagrant-1cloud 1.0.0 → 1.0.1

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: ac9e767924e534bda2a0881d4af2e6a81fb79f20
4
- data.tar.gz: 3456e6d8e3e24df137491c731d9a2c03e7742a1f
3
+ metadata.gz: d83849e0db60498b0052f554e607735aa66b13c4
4
+ data.tar.gz: 6f4e657b40235064bd4329123876c1cc23db472a
5
5
  SHA512:
6
- metadata.gz: 484d2db272268cd30e748b0cc9d4698f0c67035e5e9175675093920d49848da8f155332bfed04bed145dff98d623a97cf17b8b1ce658fd1757727c772d493b1a
7
- data.tar.gz: 71f9bab59816798aa61d19e8a8c3eb859d1d57d1d1ab965633a98c64a41b12e11f5baa0a6b0df60fec61cf929d251ec87ad391231f2ae718f7c8f52fa8e9bfcc
6
+ metadata.gz: ab15df8586266cdc18b8f2be900ba58be99c5ebb8ec87f7f6db607774dfbb47f7ad40a7eb1025dcdce4ff9ee98c22a516254f9fd44565a896cccf32bdbd87deb
7
+ data.tar.gz: d3f383c4b79455cb10b1cb7afd3179a0bff32b30661c5249335a6800c03c022af48f79fe9cd3a73ba8941ff307c6bd356fe64be4e542f875fcc08b78c3324c13
data/.gitignore CHANGED
@@ -1,5 +1,3 @@
1
- vagrant-1cloud.iml
2
- .idea
3
1
  /.bundle/
4
2
  /.yardoc
5
3
  /Gemfile.lock
@@ -8,4 +6,7 @@ vagrant-1cloud.iml
8
6
  /doc/
9
7
  /pkg/
10
8
  /spec/reports/
11
- /tmp/
9
+ /tmp/
10
+ vagrant-1cloud.iml
11
+ /.idea/
12
+ /.svn/
@@ -6,7 +6,6 @@ module VagrantPlugins
6
6
  module Actions
7
7
  class Create
8
8
  include Helpers::Client
9
- include Vagrant::Util::Retryable
10
9
 
11
10
  def initialize(app, env)
12
11
  @app = app
@@ -54,9 +53,36 @@ module VagrantPlugins
54
53
  @machine.config.ssh.username = 'root'
55
54
 
56
55
  # wait for ssh to be ready
57
- retryable(:tries => 120, :sleep => 10) do
58
- next if env[:interrupted]
59
- raise 'not ready' if !@machine.communicate.ready?
56
+ $reboot_num = 3
57
+ $check_num = 20
58
+ $i = 0
59
+ while $i <= $reboot_num do
60
+ $j = 0
61
+ while !@machine.communicate.ready? && $j < $check_num do
62
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_off')
63
+ sleep 10
64
+ $j += 1
65
+ end
66
+
67
+ if $j < $check_num
68
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_on')
69
+ break
70
+ else
71
+ if $i < $reboot_num
72
+ # submit reboot droplet request
73
+ result = @client.post("/server/#{@machine.id}/action", {
74
+ :Type => 'PowerReboot'
75
+ })
76
+
77
+ # wait for request to complete
78
+ env[:ui].info I18n.t('vagrant_1cloud.info.reloading')
79
+ @client.wait_for_event(env, @machine.id, result['body']['ID'])
80
+
81
+ $i += 1
82
+ else
83
+ raise 'not ready'
84
+ end
85
+ end
60
86
  end
61
87
 
62
88
  # change host name
@@ -5,7 +5,6 @@ module VagrantPlugins
5
5
  module Actions
6
6
  class PowerOn
7
7
  include Helpers::Client
8
- include Vagrant::Util::Retryable
9
8
 
10
9
  def initialize(app, env)
11
10
  @app = app
@@ -31,9 +30,36 @@ module VagrantPlugins
31
30
  @machine.config.ssh.username = 'root'
32
31
 
33
32
  # wait for ssh to be ready
34
- retryable(:tries => 120, :sleep => 10) do
35
- next if env[:interrupted]
36
- raise 'not ready' if !@machine.communicate.ready?
33
+ $reboot_num = 3
34
+ $check_num = 20
35
+ $i = 0
36
+ while $i <= $reboot_num do
37
+ $j = 0
38
+ while !@machine.communicate.ready? && $j < $check_num do
39
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_off')
40
+ sleep 10
41
+ $j += 1
42
+ end
43
+
44
+ if $j < $check_num
45
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_on')
46
+ break
47
+ else
48
+ if $i < $reboot_num
49
+ # submit reboot droplet request
50
+ result = @client.post("/server/#{@machine.id}/action", {
51
+ :Type => 'PowerReboot'
52
+ })
53
+
54
+ # wait for request to complete
55
+ env[:ui].info I18n.t('vagrant_1cloud.info.reloading')
56
+ @client.wait_for_event(env, @machine.id, result['body']['ID'])
57
+
58
+ $i += 1
59
+ else
60
+ raise 'not ready'
61
+ end
62
+ end
37
63
  end
38
64
 
39
65
  @machine.config.ssh.username = user
@@ -5,7 +5,6 @@ module VagrantPlugins
5
5
  module Actions
6
6
  class Reload
7
7
  include Helpers::Client
8
- include Vagrant::Util::Retryable
9
8
 
10
9
  def initialize(app, env)
11
10
  @app = app
@@ -28,9 +27,36 @@ module VagrantPlugins
28
27
  @machine.config.ssh.username = 'root'
29
28
 
30
29
  # wait for ssh to be ready
31
- retryable(:tries => 120, :sleep => 10) do
32
- next if env[:interrupted]
33
- raise 'not ready' if !@machine.communicate.ready?
30
+ $reboot_num = 3
31
+ $check_num = 20
32
+ $i = 0
33
+ while $i <= $reboot_num do
34
+ $j = 0
35
+ while !@machine.communicate.ready? && $j < $check_num do
36
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_off')
37
+ sleep 10
38
+ $j += 1
39
+ end
40
+
41
+ if $j < $check_num
42
+ env[:ui].info I18n.t('vagrant_1cloud.info.ssh_on')
43
+ break
44
+ else
45
+ if $i < $reboot_num
46
+ # submit reboot droplet request
47
+ result = @client.post("/server/#{@machine.id}/action", {
48
+ :Type => 'PowerReboot'
49
+ })
50
+
51
+ # wait for request to complete
52
+ env[:ui].info I18n.t('vagrant_1cloud.info.reloading')
53
+ @client.wait_for_event(env, @machine.id, result['body']['ID'])
54
+
55
+ $i += 1
56
+ else
57
+ raise 'not ready'
58
+ end
59
+ end
34
60
  end
35
61
 
36
62
  @machine.config.ssh.username = user
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OneCloud
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  end
5
5
  end
data/locales/en.yml CHANGED
@@ -14,6 +14,8 @@ en:
14
14
  creating_user: "Creating user account: %{user}..."
15
15
  setting_private_network: "Setting private network..."
16
16
  creating_private_network: "Creating private network..."
17
+ ssh_off: "ssh connection is off"
18
+ ssh_on: "ssh connection is on"
17
19
  config:
18
20
  token: "Token is required"
19
21
  private_key: "SSH private key path is required"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-1cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bulat Yusupov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-07 00:00:00.000000000 Z
11
+ date: 2017-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday