vagrant-1cloud 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -3
- data/lib/vagrant-1cloud/actions/create.rb +30 -4
- data/lib/vagrant-1cloud/actions/power_on.rb +30 -4
- data/lib/vagrant-1cloud/actions/reload.rb +30 -4
- data/lib/vagrant-1cloud/version.rb +1 -1
- data/locales/en.yml +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d83849e0db60498b0052f554e607735aa66b13c4
|
4
|
+
data.tar.gz: 6f4e657b40235064bd4329123876c1cc23db472a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab15df8586266cdc18b8f2be900ba58be99c5ebb8ec87f7f6db607774dfbb47f7ad40a7eb1025dcdce4ff9ee98c22a516254f9fd44565a896cccf32bdbd87deb
|
7
|
+
data.tar.gz: d3f383c4b79455cb10b1cb7afd3179a0bff32b30661c5249335a6800c03c022af48f79fe9cd3a73ba8941ff307c6bd356fe64be4e542f875fcc08b78c3324c13
|
data/.gitignore
CHANGED
@@ -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
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|