conoha 0.4.0 → 0.5.0

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: 473062afde273a22ca4cab8b773969a30ebf637d
4
- data.tar.gz: c1adfc08fa4d96a4f18a0b45e5ac1accf4106456
3
+ metadata.gz: e81891510ddcc9fdfc2b1027a3b65e9d2e6b2686
4
+ data.tar.gz: 65355f39a13a484421d769b79413f732b1628e3d
5
5
  SHA512:
6
- metadata.gz: 28765775ca83749b33288dd4a8580da4cbae39a2c3bd43b4d7bdcd621da432105c80d47f46b7cbe26972c2a134d3b3e14b6f845bd0b1b1cbb0abf1b6045efa55
7
- data.tar.gz: 18aad9e6376a7eecfb14fcbbc8b50048479965d6b17548905f539474c2e9b56c9d9e7fbcce615a302648331626f1c7370a89db231b609a778a64da70dc7a802a
6
+ metadata.gz: dd8d417d5dbdab50ff059a35c5eefef62a016408dab659ec11df5e291cb787b2c2c2df47c8d1637eda33e9a77d8ef6f3dd6fff7cad96ab5fecfa8916c27b1dcb
7
+ data.tar.gz: bda8f6cb9d318238662adfb5b528e701b787c4d9632acb6db98c578686edb0d1f0c6937ca857966743fb365aaa55297b98d18c5b2d9ea8ec4b76ab9b3fda70b4
data/README.md CHANGED
@@ -55,7 +55,7 @@ conoha create ubuntu g-1gb
55
55
  # Remember the UUID of created VPS
56
56
 
57
57
  # Create VPSs with other options
58
- conoha create centos71 g-2gb
58
+ conoha create centos72 g-2gb
59
59
  conoha create arch g-4gb
60
60
 
61
61
  # You can check VPS UUIDs
@@ -157,6 +157,9 @@ conoharant restore
157
157
  conoharant clean
158
158
  conoharant browse
159
159
  conoharant browse 3000
160
+ conoharant halt
161
+ conoharant shutdown
162
+ conoharant destroy
160
163
  ```
161
164
 
162
165
  ## License
@@ -60,24 +60,68 @@ case arg
60
60
  when 'status'
61
61
  puts status['status']
62
62
  when 'up'
63
- begin
64
- server_id = Conoha.create config['os'], config['ram']
65
- rescue => e
66
- STDERR.puts e.to_s
63
+ if status['status'] == 'running'
64
+ puts "# Nothing to do."
65
+ exit 0
66
+ end
67
+ if status['id'].nil?
68
+ begin
69
+ server_id = Conoha.create config['os'], config['ram']
70
+ rescue => e
71
+ STDERR.puts e.to_s
72
+ exit 1
73
+ end
74
+ puts server_id
75
+ loop do
76
+ sleep 10
77
+ result = Conoha.status_of server_id
78
+ break if result == "ACTIVE"
79
+ puts "# Current status is \"#{result}\", not \"ACTIVE\"."
80
+ puts "# Re-check after 10 seconds..."
81
+ end
82
+ puts "# OK!"
83
+ status['id'] = server_id
84
+ else
85
+ server_id = status['id']
86
+ puts "conoha boot #{server_id}"
87
+ Conoha.boot server_id
88
+ end
89
+ status['status'] = 'running'
90
+ dump_conoharant_status status
91
+ when 'halt', 'shutdown'
92
+ if status['status'] != 'running'
93
+ STDERR.puts "A running VPS doesn't exist."
67
94
  exit 1
68
95
  end
69
- puts server_id
70
- loop do
96
+ server_id = status['id']
97
+ puts "conoha shutdown #{server_id}"
98
+ Conoha.shutdown server_id
99
+ status['status'] = 'shutdown'
100
+ dump_conoharant_status status
101
+ when 'destroy'
102
+ if status['status'] == 'nothing'
103
+ puts "# Nothing to do."
104
+ exit 0
105
+ end
106
+ server_id = status['id']
107
+ if status['status'] == 'running'
108
+ puts "conoha shutdown #{server_id}"
109
+ Conoha.shutdown server_id
71
110
  sleep 10
111
+ end
112
+ loop do
72
113
  result = Conoha.status_of server_id
73
- break if result == "ACTIVE"
74
- puts "# Current status is \"#{result}\", not \"ACTIVE\"."
114
+ break if result == "SHUTOFF"
115
+ puts "# Current status is \"#{result}\", not \"SHUTOFF\"."
75
116
  puts "# Re-check after 10 seconds..."
117
+ sleep 10
76
118
  end
77
- puts "# OK!"
78
- status['status'] = 'running'
79
- status['id'] = server_id
119
+ puts "conoha delete #{server_id}"
120
+ Conoha.delete server_id
121
+ status['status'] = 'nothing'
122
+ status['id'] = nil
80
123
  dump_conoharant_status status
124
+ puts "# OK!"
81
125
  when 'ssh', 'mosh'
82
126
  connection = arg # 'ssh' or 'mosh'
83
127
  if status['status'] != 'running'
@@ -70,6 +70,7 @@ def image_ref_from_os(os)
70
70
  'centos66' => '14961158-a69c-4af1-b375-b9a72982837d', # CentOS 6.6
71
71
  'centos67' => '91944101-df61-4c41-b7c5-76cebfc48318', # CentOS 6.7
72
72
  'centos71' => 'edc9457e-e4a8-4974-8217-c254d215b460', # CentOS 7.1
73
+ 'centos72' => '78c0d074-fe07-4408-9582-b5525534e975', # CentOS 7.2
73
74
  'arch' => 'fe22a9e4-8ba1-4ea3-90ce-d59d5e5b35b9', # Arch
74
75
  }
75
76
  if dictionary.keys.include? os
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.4.0"
2
+ ITSELF = "0.5.0"
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler