conoha 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f41ee42c0f0098bf3b05802d35a6707d717d45a1
4
- data.tar.gz: e68e7f4b8ce9b6cd90f01702a3d3d1c3eec12ac6
3
+ metadata.gz: 2bba341ad5843b6533ad8eb71b9c422b24ab79f3
4
+ data.tar.gz: 343c61e0b27f778a2a338078562cf15ea579ba8d
5
5
  SHA512:
6
- metadata.gz: d8280fe6a8af21f48ea8056e6fcd4ec8815d599a98ee9fa85f457cecce55259fae779e082cd92bda6dabde1e9581615eef6e622b010cbb3ae191909c6aba0f15
7
- data.tar.gz: 77049d6f8806c7ebc8147bcb48dbada534119d18fd7056cdb43b13117c48cd6a0f4e67cd4a4b98de4381df421cca40ad165cd5a9461db794b0bcefb8e8fa93d1
6
+ metadata.gz: 19a0f02a6debe27af3537a56b03dd2efe5ae6259f7e8e5c4cbf4346e447382fd45c133d038f0a5538200717848679821aea5f11cdf3e1a5a2ed95bfd9ef843ad
7
+ data.tar.gz: 2d2873c4271e5c3633e65153909b3b50c82a046711a07618f2ccc552cf2e0ad6395e58be85671cf9b8da70f841b6e8f2a4d48e83c83a8c1259d34252c5fb8055
data/exe/conoha CHANGED
@@ -42,7 +42,12 @@ when 'ipaddress'
42
42
  exit 1 if ARGV.size != 1
43
43
  pp Conoha.ip_address_of server_id(ARGV.first)
44
44
  when 'create'
45
- pp Conoha.create *ARGV
45
+ begin
46
+ pp Conoha.create *ARGV
47
+ rescue => e
48
+ STDERR.puts e.to_s
49
+ exit 1
50
+ end
46
51
  when 'delete'
47
52
  exit 1 if ARGV.size != 1
48
53
  puts Conoha.delete server_id(ARGV.first)
@@ -30,6 +30,7 @@ def dump_conoharant_status(status)
30
30
  end
31
31
 
32
32
  require 'conoha'
33
+ require 'conoha/version'
33
34
  Conoha.init!
34
35
  begin
35
36
  Conoha.vps_list
@@ -48,6 +49,27 @@ puts "Authentication OK."
48
49
 
49
50
  arg = ARGV.first
50
51
  case arg
52
+ when 'version', '--version', '-v'
53
+ puts ConohaVersion::ITSELF
54
+ when 'up'
55
+ begin
56
+ server_id = Conoha.create config['os'], config['ram']
57
+ rescue => e
58
+ STDERR.puts e.to_s
59
+ exit 1
60
+ end
61
+ puts server_id
62
+ loop do
63
+ sleep 10
64
+ result = Conoha.status_of server_id
65
+ break if result == "ACTIVE"
66
+ puts "# Current status is \"#{result}\", not \"ACTIVE\"."
67
+ puts "# Re-check after 10 seconds..."
68
+ end
69
+ puts "# OK!"
70
+ status['status'] = 'running'
71
+ status['id'] = server_id
72
+ dump_conoharant_status status
51
73
  when 'ssh', 'mosh'
52
74
  connection = arg # 'ssh' or 'mosh'
53
75
  if status['status'] != 'running'
@@ -181,26 +181,6 @@ EOS
181
181
  @@public_key
182
182
  end
183
183
 
184
- def self.image_ref_from_os(os)
185
- dictionary = {
186
- 'ubuntu' => '4952b4e5-67bb-4f84-991f-9f3f1647d63d', # Ubuntu 14.04 amd64
187
- 'centos66' => '14961158-a69c-4af1-b375-b9a72982837d', # CentOS 6.6
188
- 'centos67' => '91944101-df61-4c41-b7c5-76cebfc48318', # CentOS 6.7
189
- 'centos71' => 'edc9457e-e4a8-4974-8217-c254d215b460', # CentOS 7.1
190
- 'arch' => 'fe22a9e4-8ba1-4ea3-90ce-d59d5e5b35b9', # Arch
191
- }
192
- if dictionary.keys.include? os
193
- dictionary[os]
194
- else
195
- STDERR.print <<EOS
196
- select os name from the following list:
197
-
198
- #{dictionary.keys.map { |e| " #{e}" }.join("\n")}
199
- EOS
200
- exit 1
201
- end
202
- end
203
-
204
184
  def self.flavor_ref(ram)
205
185
  dictionary = {
206
186
  'g-1gb' => '7eea7469-0d85-4f82-8050-6ae742394681',
@@ -60,3 +60,25 @@ end
60
60
  def ipv4(ip_address)
61
61
  ip_address.select { |e| e =~ /\d+\.\d+\.\d+\.\d+/ }.first
62
62
  end
63
+
64
+ # @return [String] UUID of image
65
+ # @params [String] os OS name
66
+ # @raise [StandardError] When the OS name isn't be contained.
67
+ def image_ref_from_os(os)
68
+ dictionary = {
69
+ 'ubuntu' => '4952b4e5-67bb-4f84-991f-9f3f1647d63d', # Ubuntu 14.04 amd64
70
+ 'centos66' => '14961158-a69c-4af1-b375-b9a72982837d', # CentOS 6.6
71
+ 'centos67' => '91944101-df61-4c41-b7c5-76cebfc48318', # CentOS 6.7
72
+ 'centos71' => 'edc9457e-e4a8-4974-8217-c254d215b460', # CentOS 7.1
73
+ 'arch' => 'fe22a9e4-8ba1-4ea3-90ce-d59d5e5b35b9', # Arch
74
+ }
75
+ if dictionary.keys.include? os
76
+ dictionary[os]
77
+ else
78
+ raise StandardError.new <<EOS
79
+ Select os name from the following list:
80
+
81
+ #{dictionary.keys.join("\n")}
82
+ EOS
83
+ end
84
+ end
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.2.2"
2
+ ITSELF = "0.2.3"
3
3
  end
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.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-20 00:00:00.000000000 Z
11
+ date: 2015-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler