conoha 0.7.1 → 0.7.2
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/.travis.yml +1 -2
- data/Guardfile +3 -11
- data/LICENSE.txt +1 -1
- data/README.md +4 -3
- data/exe/conoha +3 -0
- data/lib/conoha.rb +15 -8
- data/lib/conoha/util.rb +31 -1
- data/lib/conoha/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ab3ff94a231bbb1a106e9be65d7b409742c7032
|
4
|
+
data.tar.gz: c24d9fddfbc25952b0032dc2d747edd51a6fc1eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d1d48a1c8ebdb485454b41eb9fd54b0e21adc3fa6c67dbf219def62ce836311f56d07b0e0e8339408e5b2d89adcd9b870a2fd4e7ace1afd21f5963a42a7e258
|
7
|
+
data.tar.gz: f7638572a90b3fe49882fd97b3148cddf37e80ef5543e1aec23baa0346dbc30b9832c51db6abe79704bad769bbb8eda7c5768722cbd3d41c843f9f092a9b62b5
|
data/.travis.yml
CHANGED
data/Guardfile
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
# vim: ft=ruby
|
2
2
|
|
3
|
-
# @param [String] m1 e.g. 'foo/bar/a' when the matched string is 'lib/foo/bar/a.rb'
|
4
|
-
# @return [String] e.g. 'test/foo/bar/test_a.rb' when m1 is 'foo/bar/a'
|
5
|
-
def lib2test(m1)
|
6
|
-
"test/#{File.dirname m1}/test_#{File.basename m1}.rb"
|
7
|
-
end
|
8
|
-
|
9
3
|
guard :minitest do
|
10
|
-
watch(
|
11
|
-
watch(
|
12
|
-
watch(
|
13
|
-
watch(%r{^test/.+\/test_.+\.rb$})
|
14
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| lib2test m[1] }
|
4
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
5
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
6
|
+
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
15
7
|
end
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,9 @@ conoha shutdown 01234567-89ab-cdef-0123-456789abcdef
|
|
73
73
|
# Boot VPS
|
74
74
|
conoha boot 01234567-89ab-cdef-0123-456789abcdef
|
75
75
|
|
76
|
+
# Rebuild (Re-install the OS)
|
77
|
+
conoha rebuild 01234567-89ab-cdef-0123-456789abcdef ubuntu
|
78
|
+
|
76
79
|
# Delte VPS
|
77
80
|
conoha delete 01234567-89ab-cdef-0123-456789abcdef
|
78
81
|
|
@@ -170,6 +173,4 @@ conoharant destroy
|
|
170
173
|
|
171
174
|
## License
|
172
175
|
|
173
|
-
[MIT](
|
174
|
-
|
175
|
-
Copyright (C) 2015-2016 ka
|
176
|
+
[MIT](LICENSE.txt)
|
data/exe/conoha
CHANGED
data/lib/conoha.rb
CHANGED
@@ -44,16 +44,26 @@ class Conoha
|
|
44
44
|
imageRef: image_ref_from_os(os),
|
45
45
|
flavorRef: flavor_ref(ram),
|
46
46
|
key_name: public_key,
|
47
|
-
security_groups: [
|
48
|
-
{name: 'default'},
|
49
|
-
{name: 'gncs-ipv4-all'}
|
50
|
-
]
|
47
|
+
security_groups: [{name: 'default'}, {name: 'gncs-ipv4-all'}],
|
51
48
|
}
|
52
49
|
}
|
53
50
|
res = https_post uri, payload, authtoken
|
54
51
|
JSON.parse(res.body)["server"]["id"]
|
55
52
|
end
|
56
53
|
|
54
|
+
def self.rebuild(server_id, os)
|
55
|
+
uri = "https://compute.tyo1.conoha.io/v2/#{tenant_id}/servers/#{server_id}/action"
|
56
|
+
payload = {
|
57
|
+
rebuild: {
|
58
|
+
imageRef: image_ref_from_os(os),
|
59
|
+
adminPass: randstr,
|
60
|
+
key_name: public_key
|
61
|
+
}
|
62
|
+
}
|
63
|
+
res = https_post uri, payload, authtoken
|
64
|
+
res.code == '202' ? 'OK' : 'Error'
|
65
|
+
end
|
66
|
+
|
57
67
|
def self.delete(server_id)
|
58
68
|
uri = "https://compute.tyo1.conoha.io/v2/#{tenant_id}/servers/#{server_id}"
|
59
69
|
res = https_delete uri, authtoken
|
@@ -113,10 +123,7 @@ class Conoha
|
|
113
123
|
imageRef: image_ref,
|
114
124
|
flavorRef: flavor_ref(ram),
|
115
125
|
key_name: public_key,
|
116
|
-
security_groups: [
|
117
|
-
{name: 'default'},
|
118
|
-
{name: 'gncs-ipv4-all'}
|
119
|
-
]
|
126
|
+
security_groups: [{name: 'default'}, {name: 'gncs-ipv4-all'}],
|
120
127
|
}
|
121
128
|
}
|
122
129
|
res = https_post uri, payload, authtoken
|
data/lib/conoha/util.rb
CHANGED
@@ -63,7 +63,7 @@ end
|
|
63
63
|
|
64
64
|
# @return [String] UUID of image
|
65
65
|
# @params [String] os OS name
|
66
|
-
# @raise [StandardError] When the OS name isn't
|
66
|
+
# @raise [StandardError] When the OS name isn't contained.
|
67
67
|
def image_ref_from_os(os)
|
68
68
|
dictionary = {
|
69
69
|
'ubuntu' => '793be3e1-3c33-4ab3-9779-f4098ea90eb5', # Ubuntu 14.04 amd64
|
@@ -73,6 +73,36 @@ def image_ref_from_os(os)
|
|
73
73
|
'centos72' => 'e141fc06-632e-42a9-9c2d-eec9201427ec', # CentOS 7.2
|
74
74
|
'arch' => 'f5e5b475-ebec-4973-99c7-bc8add5d16c4', # Arch
|
75
75
|
}
|
76
|
+
if dictionary.keys.include? os
|
77
|
+
dictionary[os]
|
78
|
+
else
|
79
|
+
raise StandardError.new <<EOS
|
80
|
+
"#{os}" doesn't exist.
|
81
|
+
Select os name from the following list:
|
82
|
+
|
83
|
+
#{dictionary.keys.join("\n")}
|
84
|
+
EOS
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [String] Image name tag
|
89
|
+
# @params [String] os OS name
|
90
|
+
# @raise [StandardError] When the OS name isn't included in the dictionary.
|
91
|
+
def image_tag_dictionary(os)
|
92
|
+
dictionary = {
|
93
|
+
'ubuntu' => 'vmi-ubuntu-14.04-amd64', # Ubuntu 14.04 amd64
|
94
|
+
'debian' => 'vmi-debian-8-amd64', # Debian 8 amd64
|
95
|
+
'fedora23' => 'vmi-fedora-23-amd64', # Fedora 23 amd64
|
96
|
+
'centos67' => 'vmi-centos-6.7-amd64', # CentOS 6.7
|
97
|
+
'centos72' => 'vmi-centos-7.2-amd64', # CentOS 7.2
|
98
|
+
'arch' => 'vmi-arch-amd64', # Arch
|
99
|
+
}
|
100
|
+
|
101
|
+
# 'opensuse' => 'vmi-opensuse-42.1-amd64' # openSUSE
|
102
|
+
# 'openbsd' => 'vmi-openbsd-5.8-amd64', # OpenBSD
|
103
|
+
# 'netbsd' => 'vmi-netbsd-7.0-amd64', # NetBSD
|
104
|
+
# 'freebsd' => 'vmi-freebsd-10.1-x86_64', # FreeBSD
|
105
|
+
|
76
106
|
if dictionary.keys.include? os
|
77
107
|
dictionary[os]
|
78
108
|
else
|
data/lib/conoha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conoha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -144,4 +144,3 @@ signing_key:
|
|
144
144
|
specification_version: 4
|
145
145
|
summary: ConoHa VPS CLI Tool
|
146
146
|
test_files: []
|
147
|
-
has_rdoc:
|