virtualmaster 0.0.3 → 0.0.4
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.
- data/README.mdown +7 -2
- data/lib/vmaster.rb +1 -0
- data/lib/vmaster/helpers.rb +2 -2
- data/lib/vmaster/request.rb +12 -0
- data/lib/vmaster/server_commands.rb +13 -4
- data/lib/vmaster/version.rb +1 -1
- metadata +13 -12
data/README.mdown
CHANGED
@@ -48,8 +48,13 @@ VirtualMaster CLI can install your SSH keys to a remote machine automatically us
|
|
48
48
|
Instance ready!
|
49
49
|
Try to login using `ssh root@195.140.253.130'
|
50
50
|
|
51
|
-
If you want to specify other key (ie. not ~/.ssh/
|
51
|
+
If you want to specify other key (ie. not ~/.ssh/id\_rsa) use option `--identity IDENTITY_FILE`.
|
52
52
|
|
53
53
|
## More information
|
54
54
|
|
55
|
-
Additional topics are available in [the wiki](https://github.com/Virtualmaster/virtualmaster-cli/wiki).
|
55
|
+
Additional topics are available in [the wiki](https://github.com/Virtualmaster/virtualmaster-cli/wiki).
|
56
|
+
|
57
|
+
## Changelog
|
58
|
+
|
59
|
+
* v0.0.5 - Added support for availability zones and instance levels
|
60
|
+
* v0.0.3 - First public release
|
data/lib/vmaster.rb
CHANGED
data/lib/vmaster/helpers.rb
CHANGED
@@ -62,10 +62,10 @@ module VirtualMaster
|
|
62
62
|
profile_list.first
|
63
63
|
end
|
64
64
|
|
65
|
-
def self.create_instance(name, image_id, profile_id)
|
65
|
+
def self.create_instance(name, image_id, profile_id, realm)
|
66
66
|
api = VirtualMaster::CLI.api
|
67
67
|
|
68
|
-
api.create_instance(image_id, :name => name, :hwp_id => profile_id)
|
68
|
+
api.create_instance(image_id, :name => name, :hwp_id => profile_id, :realm_id => realm)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
#
|
4
|
+
# Monkey-patch RestClient.request to include User Agent
|
5
|
+
#
|
6
|
+
module RestClient
|
7
|
+
class Request
|
8
|
+
def default_headers
|
9
|
+
{ :accept => '*/*; q=0.5, application/xml', :accept_encoding => 'gzip, deflate', "User-Agent" => "virtualmaster-cli/#{VirtualMaster::VERSION} #{RUBY_PLATFORM}" }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -16,10 +16,14 @@ command :create do |c|
|
|
16
16
|
c.option '--profile PROFILE', String, 'instance hardware profile'
|
17
17
|
c.option '--copy-id', 'install public key on a machine'
|
18
18
|
c.option '--identity IDENTITY', String, 'SSH identity to use (with --copy-id)'
|
19
|
+
c.option '--zone ZONE', String, 'Availability zone to launch instance i'
|
20
|
+
c.option '--level LEVEL', String, 'Instance level to use (personal, production)'
|
19
21
|
c.option '--wait', 'wait for instance to become operational'
|
20
22
|
c.action do |args, options|
|
21
23
|
# default values
|
22
24
|
options.default :identity => File.join(ENV['HOME'], '.ssh/id_rsa')
|
25
|
+
options.default :zone => "prague-l1"
|
26
|
+
options.default :level => "personal"
|
23
27
|
|
24
28
|
name = args.shift || abort('Server name required')
|
25
29
|
|
@@ -58,8 +62,10 @@ command :create do |c|
|
|
58
62
|
abort "Internal error: hardware profile not available" unless hwp
|
59
63
|
|
60
64
|
say "Creating '#{profile_name}' instance (#{profile[:memory]} MB memory/#{profile[:storage]/1024} GB storage)"
|
61
|
-
|
62
|
-
|
65
|
+
|
66
|
+
realm = "#{options.zone}-#{options.level}"
|
67
|
+
|
68
|
+
instance = VirtualMaster::Helpers.create_instance(name, image_id, hwp.id, realm)
|
63
69
|
|
64
70
|
# TODO handle exceptions (invalid image/profile, limits, etc.)
|
65
71
|
|
@@ -122,12 +128,12 @@ command :list do |c|
|
|
122
128
|
ip_address = "(not assigned)"
|
123
129
|
end
|
124
130
|
|
125
|
-
instances << [instance.name, instance.state, ip_address]
|
131
|
+
instances << [instance.name, instance.state, ip_address, instance.realm.id]
|
126
132
|
end
|
127
133
|
|
128
134
|
abort "No instances found" if instances.empty?
|
129
135
|
|
130
|
-
table = Terminal::Table.new :headings => ['name','state','ip_address'], :rows => instances
|
136
|
+
table = Terminal::Table.new :headings => ['name','state','ip_address', 'zone'], :rows => instances
|
131
137
|
puts table
|
132
138
|
end
|
133
139
|
end
|
@@ -136,6 +142,9 @@ def instance_action(action, args)
|
|
136
142
|
name = args.shift || abort('server name required')
|
137
143
|
|
138
144
|
instance = VirtualMaster::Helpers.get_instance(name)
|
145
|
+
|
146
|
+
abort "Invalid instance name!" if instance.nil?
|
147
|
+
|
139
148
|
instance.send("#{action}!")
|
140
149
|
end
|
141
150
|
|
data/lib/vmaster/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: virtualmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: commander
|
16
|
-
requirement: &
|
16
|
+
requirement: &70140390251200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 4.1.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70140390251200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: deltacloud-client
|
27
|
-
requirement: &
|
27
|
+
requirement: &70140390250700 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.5.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70140390250700
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: terminal-table
|
38
|
-
requirement: &
|
38
|
+
requirement: &70140255842280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.4.4
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70140255842280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: net-ssh
|
49
|
-
requirement: &
|
49
|
+
requirement: &70140255840660 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70140255840660
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70140255839140 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '2'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70140255839140
|
69
69
|
description: Command line interface to VirtualMaster. Control your virtual infrastructure.
|
70
70
|
email:
|
71
71
|
- radim@laststation.net
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- lib/vmaster/cli.rb
|
84
84
|
- lib/vmaster/config_command.rb
|
85
85
|
- lib/vmaster/helpers.rb
|
86
|
+
- lib/vmaster/request.rb
|
86
87
|
- lib/vmaster/server_commands.rb
|
87
88
|
- lib/vmaster/version.rb
|
88
89
|
- spec/commands_spec.rb
|