conoha 0.9.0 → 0.9.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: ee13720321ef8d83cb1f53ef211175785b36f3ff
4
- data.tar.gz: f46a2cdb58288e4e8c47fe25583a1d4368202c82
3
+ metadata.gz: 8d322e4f2ffd6a6db55b56af31417c5f0c1fdb11
4
+ data.tar.gz: c87a759cb19ae7da91fac60a4e3b214dda2f67cf
5
5
  SHA512:
6
- metadata.gz: b6ce881814dd2633be87afbf7f462cbb1e3718f692ec85d00b522e0290835efe4d7229a8ebf9897a2af6f36e4713018346e0df6e7a77bf9d3a09d181234c5d86
7
- data.tar.gz: 799de61271bdc30083a779154f847469346e7696599378745eb5e5760ad8b1160379a7bd86e26311cb4b36c8cf4667d83e02d7e58bad61219d32f445a26f16f6
6
+ metadata.gz: c8b2591106cd60f5d63adafa53c86303047a6e80f80640cd44eeb1ba156c3f46daf2f433a80d8d148845ed09373b68a56934963ca0a67750b8055f1fc7644d5e
7
+ data.tar.gz: 91836f62b9e2aa708d999d6dfee7c478436b0bcbdd7d3462d2e5b97f9c449f0f26b53f70b906b5c0247114b2b45e392af93562870ca0808ee22edb893e2c5ad4
data/README.md CHANGED
@@ -76,6 +76,11 @@ conoha shutdown 01234567-89ab-cdef-0123-456789abcdef
76
76
  # Boot VPS
77
77
  conoha boot 01234567-89ab-cdef-0123-456789abcdef
78
78
 
79
+ # Reboot VPS
80
+ conoha reboot 01234567-89ab-cdef-0123-456789abcdef # Shutdown -> Boot
81
+ conoha reboot 01234567-89ab-cdef-0123-456789abcdef hard # Force shutdown -> Boot
82
+ # For more information, ref. https://www.conoha.jp/docs/compute-reboot_vm.html
83
+
79
84
  # Rebuild (Re-install the OS)
80
85
  conoha rebuild 01234567-89ab-cdef-0123-456789abcdef ubuntu
81
86
 
data/exe/conoha CHANGED
@@ -88,6 +88,13 @@ when 'boot'
88
88
  when 'shutdown'
89
89
  exit 1 if ARGV.size != 1
90
90
  puts Conoha.shutdown server_id(ARGV.first)
91
+ when 'reboot'
92
+ exit 1 if ARGV.size < 1
93
+ if ARGV[1] == 'hard' || ARGV[1] == 'HARD'
94
+ puts Conoha.reboot server_id(ARGV.first), 'HARD'
95
+ else
96
+ puts Conoha.reboot server_id(ARGV.first)
97
+ end
91
98
  when 'imagelist'
92
99
  pp Conoha.images
93
100
  when 'imagecreate'
@@ -143,10 +143,11 @@ class Conoha
143
143
  JSON.parse(res.body)["server"]["status"]
144
144
  end
145
145
 
146
- # @param [String] action "os-start" or "os-stop"
147
- def self.server_action(server_id, action)
146
+ # @param [String] action "os-start", "os-stop" or "reboot"
147
+ # @param [Hash|nil] action_value (default: nil)
148
+ def self.server_action(server_id, action, action_value = nil)
148
149
  uri = "https://compute.#{region}.conoha.io/v2/#{tenant_id}/servers/#{server_id}/action"
149
- res = https_post uri, {action => nil}, authtoken
150
+ res = https_post uri, {action => action_value}, authtoken
150
151
  res.code == '202' ? 'OK' : 'Error'
151
152
  end
152
153
 
@@ -158,6 +159,12 @@ class Conoha
158
159
  server_action server_id, "os-stop"
159
160
  end
160
161
 
162
+ # @param [String] server_id
163
+ # @param [String] type "SOFT" or "HARD" (ref. https://www.conoha.jp/docs/compute-reboot_vm.html)
164
+ def self.reboot(server_id, type = "SOFT")
165
+ server_action(server_id, "reboot", { "type" => type })
166
+ end
167
+
161
168
  def self.images
162
169
  uri = "https://compute.#{region}.conoha.io/v2/#{tenant_id}/images"
163
170
  res = https_get uri, authtoken
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.9.0"
2
+ ITSELF = "0.9.1"
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.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-24 00:00:00.000000000 Z
11
+ date: 2016-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler