conoha 0.2.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e74e785f4bb9c620e31f0eaa64dc2ce4aed8755
4
- data.tar.gz: d72ed86c473189df9841b9570e462d04ab9fd9fd
3
+ metadata.gz: f41ee42c0f0098bf3b05802d35a6707d717d45a1
4
+ data.tar.gz: e68e7f4b8ce9b6cd90f01702a3d3d1c3eec12ac6
5
5
  SHA512:
6
- metadata.gz: 41567c6082d53fdc1e8f13313acdc409462043bed0b7e04c9237481a622b8f414f87dc9213c973cd86ae85296b8c870525763847c620456863839096cb033cdd
7
- data.tar.gz: 41582098947f4f5a39c9b80e9d36eb2fbb574fb8cf07c49bef020d532a32fa31714ee886d20898df57ac40f99bb5691870d7847b4c0a401f54b2bcc19700b30a
6
+ metadata.gz: d8280fe6a8af21f48ea8056e6fcd4ec8815d599a98ee9fa85f457cecce55259fae779e082cd92bda6dabde1e9581615eef6e622b010cbb3ae191909c6aba0f15
7
+ data.tar.gz: 77049d6f8806c7ebc8147bcb48dbada534119d18fd7056cdb43b13117c48cd6a0f4e67cd4a4b98de4381df421cca40ad165cd5a9461db794b0bcefb8e8fa93d1
data/README.md CHANGED
@@ -143,6 +143,7 @@ tagprefix: tagnameprefixasyoulike
143
143
  conoharant ssh
144
144
  conoharant ssh root
145
145
  conoharant mosh
146
+ conoharant sftp
146
147
  conoharant dump
147
148
  conoharant restore
148
149
  conoharant clean
@@ -108,6 +108,14 @@ when 'restore'
108
108
  ram = config['ram']
109
109
  puts "conoha restore #{image_id} #{ram}"
110
110
  server_id = Conoha.create_from_image image_id, ram
111
+ loop do
112
+ sleep 10
113
+ result = Conoha.status_of server_id
114
+ break if result == "ACTIVE"
115
+ puts "# Current status is \"#{result}\", not \"ACTIVE\"."
116
+ puts "# Re-check after 10 seconds..."
117
+ end
118
+ puts "# OK!"
111
119
  status['status'] = 'running'
112
120
  status['id'] = server_id
113
121
  dump_conoharant_status status
@@ -131,6 +139,12 @@ when 'browse'
131
139
  command = "xdg-open http://#{ipaddress}#{port}"
132
140
  puts command
133
141
  system command
142
+ when 'sftp'
143
+ server_id = status['id']
144
+ ipaddress = ipv4(Conoha.ip_address_of(server_id))
145
+ command = "sftp #{ipaddress}"
146
+ puts command
147
+ system command
134
148
  else
135
149
  STDERR.puts 'Invalid argument.'
136
150
  exit 1
@@ -63,6 +63,12 @@ class Conoha
63
63
  JSON.parse(res.body)["server"]["addresses"].values[0].map{ |e| e["addr"] }
64
64
  end
65
65
 
66
+ def self.status_of(server_id)
67
+ uri = "https://compute.tyo1.conoha.io/v2/#{tenant_id}/servers/#{server_id}"
68
+ res = https_get uri, authtoken
69
+ JSON.parse(res.body)["server"]["status"]
70
+ end
71
+
66
72
  def self.boot(server_id)
67
73
  uri = "https://compute.tyo1.conoha.io/v2/#{tenant_id}/servers/#{server_id}/action"
68
74
  res = https_post uri, {"os-start": nil}, authtoken
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.2.1"
2
+ ITSELF = "0.2.2"
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.1
4
+ version: 0.2.2
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-19 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler