rumm 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/app/controllers/loadbalancers_controller.rb +1 -1
- data/app/forms/loadbalancers/create_form.rb +3 -10
- data/lib/rumm/version.rb +1 -1
- data/rumm.gemspec +1 -1
- data/spec/features/help_spec.rb +186 -0
- data/spec/spec_helper.rb +7 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12cfc97168e61a161d41b9a84ba34d62ad0836f4
|
4
|
+
data.tar.gz: f7189d9d10836a91da7c756cdcc5f3e6ef852e12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ea79b0bfbdb737fe5874eb9f99f9b4d86ef407924b61d9064e4a4c0153731e004ba7ce026ad92f73d5e59c17e1842e7bdd06bc23a1413889936cc230e695478
|
7
|
+
data.tar.gz: 8bf6ca13962f82508a0f21b3a92086571fb5d49ffec7fe7ee3aaa646006fa957ee984c4e39b375a0c3cc1f47a1430d1b0edc9fdc1ba9633fd88b2b02f56566e3
|
data/Gemfile
CHANGED
@@ -27,6 +27,6 @@ class LoadbalancersController < MVCLI::Controller
|
|
27
27
|
private
|
28
28
|
|
29
29
|
def balancer
|
30
|
-
index.find {|s| s.name == params[:id]} or fail Fog::
|
30
|
+
index.find {|s| s.name == params[:id]} or fail Fog::Errors::NotFound, "no load balancer named #{params[:id]}"
|
31
31
|
end
|
32
32
|
end
|
@@ -9,10 +9,10 @@ class Loadbalancers::CreateForm < MVCLI::Form
|
|
9
9
|
|
10
10
|
input :protocol, String, default: 'HTTP', decode: :upcase
|
11
11
|
|
12
|
-
input :virtual_ips, [String], default: ['PUBLIC']
|
12
|
+
input :virtual_ips, [String], default: [Map(type: 'PUBLIC')], decode: ->(s) {Map(type: s.upcase)}
|
13
13
|
|
14
14
|
input :nodes, [Node], required: true do
|
15
|
-
input :address,
|
15
|
+
input :address, String, required: true, decode: ->(s) { URI('').hostname = s }
|
16
16
|
input :port, Integer, default: 80, decode: ->(s) {Integer s}
|
17
17
|
input :type, String, default: 'PRIMARY', decode: :upcase
|
18
18
|
input :condition, String, default: 'ENABLED', decode: :upcase
|
@@ -24,14 +24,7 @@ class Loadbalancers::CreateForm < MVCLI::Form
|
|
24
24
|
|
25
25
|
validates(:port, "port must be between 0 and 65,535") {|port| port >=0 && port < 65535}
|
26
26
|
|
27
|
-
validates(:nodes, "at least one node must be enabled") { |nodes|
|
27
|
+
validates(:nodes, "at least one node must be enabled", each: false) { |nodes|
|
28
28
|
nodes.any? {|n| n.condition == 'ENABLED'}
|
29
29
|
}
|
30
|
-
|
31
|
-
output do |form|
|
32
|
-
form.attributes.merge attrs = {
|
33
|
-
virtual_ips: form.virtual_ips.map {|t| Map(type: t)},
|
34
|
-
nodes: form.nodes.map(&:attributes)
|
35
|
-
}
|
36
|
-
end
|
37
30
|
end
|
data/lib/rumm/version.rb
CHANGED
data/rumm.gemspec
CHANGED
@@ -0,0 +1,186 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "interactive learning" do
|
4
|
+
Given { pending }
|
5
|
+
|
6
|
+
describe "the basic help system" do
|
7
|
+
Given {rumm "help"}
|
8
|
+
# Rumm: A tasty tool for hackers and pirates
|
9
|
+
# Rumm provides a command line interface for hacking with Rackspace. The
|
10
|
+
# only thing you'll need to get started is a username and password from
|
11
|
+
# your Rackspace hosting account. e.g.
|
12
|
+
#
|
13
|
+
# rumm login
|
14
|
+
# Username: rsteveson
|
15
|
+
# Password: ******
|
16
|
+
# logged in as rstevenson, credentials written to ~/.netrc
|
17
|
+
#
|
18
|
+
# And you're good to go! The following commands are available in your Rumm
|
19
|
+
# environment:
|
20
|
+
#
|
21
|
+
# Authentication:
|
22
|
+
# rumm login
|
23
|
+
# rumm logout
|
24
|
+
#
|
25
|
+
# Images:
|
26
|
+
# show images
|
27
|
+
# rum show images
|
28
|
+
#
|
29
|
+
# Servers:
|
30
|
+
# rumm show servers
|
31
|
+
# rumm show server :id
|
32
|
+
# rumm create server
|
33
|
+
# rumm update server :id
|
34
|
+
# rumm destroy server :id
|
35
|
+
# rumm ssh :id
|
36
|
+
|
37
|
+
# Loadbalancers:
|
38
|
+
# rumm show loadbalancers
|
39
|
+
# rumm show loadbalancer :id
|
40
|
+
# rumm create loadbalancer
|
41
|
+
# rumm update loadbalancer :id
|
42
|
+
# rumm destroy loadbalancer :id
|
43
|
+
#
|
44
|
+
# Nodes:
|
45
|
+
# rumm show nodes on loadbalancer :loadbalancer_id
|
46
|
+
# rumm show node :id on loadbalancer :loadbalancer_id
|
47
|
+
# rumm create node on loadbalancer :loadbalancer_id
|
48
|
+
# rumm update node :id on loadbalancer :loadbalancer_id
|
49
|
+
# rumm destroy node :id on loadbalancer :loadbalancer_id
|
50
|
+
#
|
51
|
+
# Dbinstances:
|
52
|
+
# rumm show dbinstances
|
53
|
+
# rumm show dbinstance :id
|
54
|
+
# rumm create dbinstance
|
55
|
+
# rumm update dbinstance :id
|
56
|
+
# rumm destroy dbinstance :id
|
57
|
+
#
|
58
|
+
# Databases:
|
59
|
+
# rumm show databases on dbinstance :instance_id
|
60
|
+
# rumm show database :id on dbinstance :instance_id
|
61
|
+
# rumm create database on dbinstance :instance_id
|
62
|
+
# rumm update database :id on dbinstance :instance_id
|
63
|
+
# rumm destroy database :id on dbinstance :instance_id
|
64
|
+
#
|
65
|
+
# Users:
|
66
|
+
# rumm show users on dbinstance :dbinstance_id
|
67
|
+
# rumm show user :id on dbinstance :dbinstance_id
|
68
|
+
# rumm create user on dbinstance :dbinstance_id
|
69
|
+
#
|
70
|
+
# Containers:
|
71
|
+
# rumm show containers
|
72
|
+
# rumm show container :id
|
73
|
+
# rumm create container
|
74
|
+
# rumm update container :id
|
75
|
+
# rumm destroy container :id
|
76
|
+
#
|
77
|
+
# Files:
|
78
|
+
# rumm show files in container :container_id
|
79
|
+
# rumm show file :id on container :container_id
|
80
|
+
# rumm create file :id on container :container_id
|
81
|
+
# rumm update file :id on container :container_id
|
82
|
+
# rumm destroy file :id on container :container_id
|
83
|
+
# rumm download file :id on container :container_id
|
84
|
+
#
|
85
|
+
# Volumes:
|
86
|
+
# rumm show volumes
|
87
|
+
# rumm show volume :id
|
88
|
+
# rumm create volume
|
89
|
+
# rumm update volume :id
|
90
|
+
# rumm destroy volume :id
|
91
|
+
#
|
92
|
+
# Attachments:
|
93
|
+
# rumm show attachments on server :server_id
|
94
|
+
# rumm attach volume :id to server :server_id
|
95
|
+
# rumm detach volume :id from server :server_id
|
96
|
+
|
97
|
+
#
|
98
|
+
#> With aggretate help topic per controller e.g. one listing for all server commands
|
99
|
+
|
100
|
+
Given {rumm "help servers"}
|
101
|
+
# Description:
|
102
|
+
# Rumm allows you to manipulate all of your cloud servers from the command line
|
103
|
+
# including creating, listing, updating and destroying them.
|
104
|
+
# Commands:
|
105
|
+
# rumm show servers
|
106
|
+
# rumm create server
|
107
|
+
# rumm show server ID
|
108
|
+
# rumm destroy server ID
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "the error message when the input is invalid" do
|
113
|
+
#> What does error look like when you're missing a required argument?
|
114
|
+
#
|
115
|
+
# rumm destroy server
|
116
|
+
# missing required argument(s) :id
|
117
|
+
# run `rumm help destroy server` for a complete listing of options.
|
118
|
+
#
|
119
|
+
#> What is the error when a server doesn't exist?
|
120
|
+
# rumm destroy server does-not-exist
|
121
|
+
# no such server named 'does-not-exist'
|
122
|
+
|
123
|
+
#> what is error when you're missing an option or the option is invalid?
|
124
|
+
# e.g.
|
125
|
+
# rumm create loadbalancer --node 10.0.0.1:-100 --node xxx:80 --port -1
|
126
|
+
# input:
|
127
|
+
# --port: `-1` is not a valid port number (port >= 0 && port <= 65535)
|
128
|
+
# --nodes[0][port] `-100` is not a valid port number (port >= 0 && port <= 65535)
|
129
|
+
# errors:
|
130
|
+
# --nodes[1][address]: 'xxx' -> IPAddr::InvalidAddressError: invalid address
|
131
|
+
|
132
|
+
Given {rumm "create loadbalancer --node 10.0.0.1:999999 --node xxx:80 --port -1"}
|
133
|
+
Then {output.contains "--port: '-1' is not a valid port number (port >= 0 && port <= 65535)"}
|
134
|
+
Then {output.contains "--node[0][port] '999999' is not a valid port number (port >= 0 && port <= 65535)" }
|
135
|
+
Then {output =~ /--node\[1\]\[address\]: 'xxx' -> .+Error: .+/}
|
136
|
+
end
|
137
|
+
|
138
|
+
#> Show all commands
|
139
|
+
|
140
|
+
|
141
|
+
#> there is a partial match but no command
|
142
|
+
|
143
|
+
# rumm show
|
144
|
+
# no command found for 'rum show'. Possible matches are
|
145
|
+
# rumm show servers
|
146
|
+
# rumm show server :id
|
147
|
+
# rumm show dbinstances
|
148
|
+
# ...
|
149
|
+
|
150
|
+
#> show a single action / command>
|
151
|
+
describe "help for a specific command" do
|
152
|
+
Given {rumm "help create server"}
|
153
|
+
|
154
|
+
# Usage:
|
155
|
+
# rumm create server [--name STRING] [--image-id STRING] [--flavor-id STRING]
|
156
|
+
#
|
157
|
+
# Options:
|
158
|
+
# -n, --name STRING # Name to give the new server
|
159
|
+
# -i, --image-id STRING # use this VM image
|
160
|
+
# -f, --flavor-id STRING # create with the specified flavor
|
161
|
+
#
|
162
|
+
# Description:
|
163
|
+
# creates a new next-generation rackspace cloud server. If you do not
|
164
|
+
# specify a name, then one will be provided for you. The name can be
|
165
|
+
# to identify this server for other commands.
|
166
|
+
#
|
167
|
+
# Examples:
|
168
|
+
# rumm create server
|
169
|
+
# rumm create server --name rumm-example-server
|
170
|
+
# rumm create server --image-id 9922a7c7-5a42-4a56-bc6a-93f857ae2346 --flavor-id 3
|
171
|
+
|
172
|
+
Given { rumm "help show server" }
|
173
|
+
|
174
|
+
# Usage:
|
175
|
+
# rumm show server ID
|
176
|
+
#
|
177
|
+
# Arguments:
|
178
|
+
# ID: STRING # Name of the server to show
|
179
|
+
#
|
180
|
+
# Description:
|
181
|
+
# Looks up the server named ID and returns its details including ipaddress
|
182
|
+
# etc.
|
183
|
+
#
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,10 +3,15 @@ require "vcr"
|
|
3
3
|
require "aruba/api"
|
4
4
|
require "rspec-given"
|
5
5
|
|
6
|
-
module Rumm::
|
6
|
+
module Rumm::SpecHelper
|
7
7
|
def will_type(string)
|
8
8
|
Aruba::InProcess.main_class.input << _ensure_newline(string)
|
9
9
|
end
|
10
|
+
|
11
|
+
def rumm(command)
|
12
|
+
run_interactive "rumm #{command}"
|
13
|
+
stop_process @interactive
|
14
|
+
end
|
10
15
|
end
|
11
16
|
|
12
17
|
RSpec.configure do |config|
|
@@ -14,7 +19,7 @@ RSpec.configure do |config|
|
|
14
19
|
config.include Aruba::Api, :example_group => {
|
15
20
|
:file_path => /spec\/features/
|
16
21
|
}
|
17
|
-
config.include Rumm::
|
22
|
+
config.include Rumm::SpecHelper
|
18
23
|
|
19
24
|
config.before(:each) do
|
20
25
|
@__aruba_original_paths = (ENV['PATH'] || '').split(File::PATH_SEPARATOR)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
UgImJlChAzCoDP9zi9tdm6jAr7ttF25R9PPYr11ILb7dYe3qUzlNlM6zJx/nb31b
|
30
30
|
IhdyRVup4qLcqYSTPsm6u7VA
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-07-
|
32
|
+
date: 2013-07-10 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: mvcli
|
@@ -37,14 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.10
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.10
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: fog
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- lib/rumm.rb
|
167
167
|
- lib/rumm/version.rb
|
168
168
|
- rumm.gemspec
|
169
|
+
- spec/features/help_spec.rb
|
169
170
|
- spec/features/login_spec.rb
|
170
171
|
- spec/features/servers_spec.rb
|
171
172
|
- spec/fixtures/cassettes/create-server.yml
|
@@ -200,6 +201,7 @@ signing_key:
|
|
200
201
|
specification_version: 4
|
201
202
|
summary: CLI and API for managing Rackspace infrastructure
|
202
203
|
test_files:
|
204
|
+
- spec/features/help_spec.rb
|
203
205
|
- spec/features/login_spec.rb
|
204
206
|
- spec/features/servers_spec.rb
|
205
207
|
- spec/fixtures/cassettes/create-server.yml
|