exe/conoharant in conoha-0.2.2 vs exe/conoharant in conoha-0.2.3
- old
+ new
@@ -28,10 +28,11 @@
def dump_conoharant_status(status)
File.open('.conoharant/status.yml', 'w').print(YAML.dump(status))
end
require 'conoha'
+require 'conoha/version'
Conoha.init!
begin
Conoha.vps_list
rescue => e
puts "Auth token is invalid."
@@ -46,9 +47,30 @@
end
puts "Authentication OK."
arg = ARGV.first
case arg
+when 'version', '--version', '-v'
+ puts ConohaVersion::ITSELF
+when 'up'
+ begin
+ server_id = Conoha.create config['os'], config['ram']
+ rescue => e
+ STDERR.puts e.to_s
+ exit 1
+ end
+ puts server_id
+ loop do
+ sleep 10
+ result = Conoha.status_of server_id
+ break if result == "ACTIVE"
+ puts "# Current status is \"#{result}\", not \"ACTIVE\"."
+ puts "# Re-check after 10 seconds..."
+ end
+ puts "# OK!"
+ status['status'] = 'running'
+ status['id'] = server_id
+ dump_conoharant_status status
when 'ssh', 'mosh'
connection = arg # 'ssh' or 'mosh'
if status['status'] != 'running'
STDERR.puts "VPS is not running."
exit 1