rhc 0.97.17 → 0.98.16
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/bin/rhc +9 -9
- data/bin/rhc-port-forward +3 -0
- data/bin/rhc-sshkey +3 -0
- data/features/README.md +163 -35
- data/features/application.feature +24 -0
- data/features/cartridge.feature +24 -0
- data/features/client.feature +11 -0
- data/features/domain.feature +29 -0
- data/features/lib/rhc_helper.rb +14 -0
- data/features/lib/rhc_helper/app.rb +2 -8
- data/features/lib/rhc_helper/cartridge.rb +1 -7
- data/features/lib/rhc_helper/commandify.rb +37 -6
- data/features/lib/rhc_helper/domain.rb +5 -1
- data/features/lib/rhc_helper/httpify.rb +124 -60
- data/features/lib/rhc_helper/loggable.rb +0 -2
- data/features/lib/rhc_helper/persistable.rb +12 -2
- data/features/lib/rhc_helper/sshkey.rb +29 -0
- data/features/multiple_cartridge.feature +17 -0
- data/features/sshkey.feature +58 -0
- data/features/step_definitions/application_steps.rb +60 -52
- data/features/step_definitions/cartridge_steps.rb +22 -24
- data/features/step_definitions/client_steps.rb +9 -2
- data/features/step_definitions/domain_steps.rb +4 -0
- data/features/step_definitions/sshkey_steps.rb +56 -0
- data/features/support/assumptions.rb +37 -0
- data/features/support/before_hooks.rb +25 -0
- data/features/support/env.rb +84 -39
- data/features/support/key1 +27 -0
- data/features/support/key1.pub +1 -0
- data/features/support/key2 +27 -0
- data/features/support/key2.pub +1 -0
- data/features/support/key3.pub +1 -0
- data/features/support/ssh.sh +2 -0
- data/features/verify.feature +18 -159
- data/lib/rhc-common.rb +8 -21
- data/lib/rhc.rb +9 -5
- data/lib/rhc/autocomplete.rb +68 -0
- data/lib/rhc/autocomplete_templates/rhc.erb +33 -0
- data/lib/rhc/cli.rb +9 -6
- data/lib/rhc/command_runner.rb +108 -0
- data/lib/rhc/commands.rb +66 -132
- data/lib/rhc/commands/base.rb +95 -24
- data/lib/rhc/commands/domain.rb +33 -50
- data/lib/rhc/commands/port-forward.rb +81 -0
- data/lib/rhc/commands/setup.rb +1 -1
- data/lib/rhc/commands/sshkey.rb +95 -0
- data/lib/rhc/config.rb +108 -103
- data/lib/rhc/context_helper.rb +19 -0
- data/lib/rhc/coverage_helper.rb +1 -1
- data/lib/rhc/exceptions.rb +55 -4
- data/lib/rhc/help_formatter.rb +2 -3
- data/lib/rhc/helpers.rb +31 -23
- data/lib/{rhc-rest.rb → rhc/rest.rb} +95 -23
- data/lib/{rhc-rest → rhc/rest}/application.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/cartridge.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/client.rb +40 -9
- data/lib/{rhc-rest → rhc/rest}/domain.rb +1 -1
- data/lib/{rhc-rest → rhc/rest}/key.rb +11 -1
- data/lib/{rhc-rest → rhc/rest}/user.rb +1 -1
- data/lib/rhc/ssh_key_helpers.rb +10 -1
- data/lib/rhc/targz.rb +7 -8
- data/lib/rhc/usage_templates/command_help.erb +7 -6
- data/lib/rhc/usage_templates/help.erb +6 -9
- data/lib/rhc/usage_templates/missing_help.erb +1 -0
- data/lib/rhc/version.rb +2 -2
- data/lib/rhc/wizard.rb +4 -9
- data/spec/coverage_helper.rb +2 -2
- data/spec/rest_spec_helper.rb +66 -16
- data/spec/rhc/cli_spec.rb +16 -5
- data/spec/rhc/command_spec.rb +61 -6
- data/spec/rhc/commands/domain_spec.rb +50 -27
- data/spec/rhc/commands/port-forward_spec.rb +133 -0
- data/spec/rhc/commands/setup_spec.rb +2 -2
- data/spec/rhc/commands/sshkey_spec.rb +141 -0
- data/spec/rhc/common_spec.rb +1 -1
- data/spec/rhc/config_spec.rb +6 -4
- data/spec/rhc/helpers_spec.rb +0 -21
- data/spec/rhc/rest_application_spec.rb +7 -7
- data/spec/rhc/rest_client_spec.rb +87 -24
- data/spec/rhc/rest_spec.rb +36 -36
- data/spec/rhc/wizard_spec.rb +3 -3
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +3 -3
- metadata +61 -31
- data/lib/rhc-rest/exceptions/exceptions.rb +0 -75
- data/test/functional/application_test.rb +0 -71
- data/test/functional/domain_test.rb +0 -123
- data/test/functional/test_credentials.rb +0 -5
- data/test/sample-usage.rb +0 -122
- data/test/support/server.rb +0 -14
- data/test/support/testcase.rb +0 -3
- data/test/test_helper.rb +0 -4
- data/test/unit/command_test.rb +0 -19
data/test/sample-usage.rb
DELETED
@@ -1,122 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Copyright 2011 Red Hat, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
|
16
|
-
require 'rhc-rest'
|
17
|
-
|
18
|
-
|
19
|
-
if __FILE__ == $0
|
20
|
-
|
21
|
-
end_point = ARGV[0]
|
22
|
-
username = ARGV[1]
|
23
|
-
password = ARGV[2]
|
24
|
-
domain_id = ARGV[3]
|
25
|
-
|
26
|
-
if end_point.nil? or username.nil? or password.nil? or domain_id.nil?
|
27
|
-
puts "Usage: https://<hostname>/broker/rest <username> <password> <domain_id>"
|
28
|
-
exit 1
|
29
|
-
end
|
30
|
-
@mydebug =true
|
31
|
-
client = Rhc::Rest::Client.new(end_point, username, password)
|
32
|
-
|
33
|
-
client.domains.each do |domain|
|
34
|
-
domain.applications.each do |app|
|
35
|
-
app.delete
|
36
|
-
end
|
37
|
-
domain.delete
|
38
|
-
end
|
39
|
-
puts "Creating a domain"
|
40
|
-
domain = client.add_domain(domain_id)
|
41
|
-
puts "Domain created: #{domain.id}"
|
42
|
-
|
43
|
-
puts "Getting all cartridges..."
|
44
|
-
client.cartridges.each do |cart|
|
45
|
-
puts " #{cart.name} (type: #{cart.type})"
|
46
|
-
end
|
47
|
-
|
48
|
-
puts "Creating application appone"
|
49
|
-
carts = client.find_cartridge("php-5.3")
|
50
|
-
domain.add_application("appone", {:cartridge => carts.first.name})
|
51
|
-
|
52
|
-
puts "Try deleting domain with an application"
|
53
|
-
begin
|
54
|
-
domain.delete
|
55
|
-
rescue Exception => e
|
56
|
-
puts e.message
|
57
|
-
end
|
58
|
-
|
59
|
-
puts "Getting all domains and applications..."
|
60
|
-
client.domains.each do |domain|
|
61
|
-
puts " Domain: #{domain.id}"
|
62
|
-
domain.applications.each do |app|
|
63
|
-
puts " Application: #{app.name}"
|
64
|
-
app.cartridges.each do |cart|
|
65
|
-
puts " Cartridge #{cart.name} (#{cart.type})"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
puts "Find application=appone and restart it..."
|
71
|
-
apps = client.find_application("appone")
|
72
|
-
apps.first.restart
|
73
|
-
|
74
|
-
apps = client.find_application("appthree")
|
75
|
-
if not apps.nil? and not apps.first.nil?
|
76
|
-
apps.first.delete
|
77
|
-
end
|
78
|
-
|
79
|
-
puts "Create new application named appthree..."
|
80
|
-
app = client.domains.first.add_application("appthree", {:cartridge =>"php-5.3"})
|
81
|
-
puts "Adding MySQL cartridge to appthree"
|
82
|
-
cartridge = app.add_cartridge("mysql-5.1")
|
83
|
-
puts "Check to see if it was added"
|
84
|
-
app.cartridges.each do |cart|
|
85
|
-
puts "Cartridge #{cart.name} (#{cart.type})"
|
86
|
-
end
|
87
|
-
|
88
|
-
puts "Restart MySQL cartridge"
|
89
|
-
cartridge.restart
|
90
|
-
puts "Deleting MySQL cartridge"
|
91
|
-
cartridge.delete
|
92
|
-
puts "Check to see if it was deleted"
|
93
|
-
if app.cartridges.size == 0
|
94
|
-
puts "MySQL cartridge is deleted"
|
95
|
-
end
|
96
|
-
puts "Deleting appthree"
|
97
|
-
app.delete
|
98
|
-
end
|
99
|
-
|
100
|
-
puts "Adding, updating and deleting keys"
|
101
|
-
key = client.user.add_key("newkey", "NEWKEYCONTENT", "ssh-rsa")
|
102
|
-
|
103
|
-
puts "Added key: #{key.name} updating key content"
|
104
|
-
key.update(key.type, "NEWKEYCONTENT123")
|
105
|
-
|
106
|
-
puts "Getting all keys..."
|
107
|
-
client.user.keys.each do |key|
|
108
|
-
puts " Key: #{key.name} (type: #{key.type}) #{key.content}"
|
109
|
-
end
|
110
|
-
|
111
|
-
puts "Deleting key"
|
112
|
-
begin
|
113
|
-
key.delete
|
114
|
-
rescue Exception => e
|
115
|
-
puts e.message
|
116
|
-
end
|
117
|
-
|
118
|
-
puts 'Clean up domains and apps by force deleting domain'
|
119
|
-
client.domains.each do |domain|
|
120
|
-
domain.delete(true)
|
121
|
-
end
|
122
|
-
|
data/test/support/server.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
class Test::Unit::TestCase
|
2
|
-
|
3
|
-
def with_devenv
|
4
|
-
omit("Cannot run unless a devenv is specified")
|
5
|
-
|
6
|
-
@random = rand(1000)
|
7
|
-
end_point = "https://ec2-23-20-154-157.compute-1.amazonaws.com/broker/rest"
|
8
|
-
username = "rhc-rest-test-#{@random}"
|
9
|
-
password = "xyz123"
|
10
|
-
@client = Rhc::Rest::Client.new(end_point, username, password)
|
11
|
-
@domains = []
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
data/test/support/testcase.rb
DELETED
data/test/test_helper.rb
DELETED
data/test/unit/command_test.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require File.expand_path('../../test_helper', __FILE__)
|
2
|
-
|
3
|
-
class CommandTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def define_test_command
|
6
|
-
Class.new(RHC::Commands::Base) do
|
7
|
-
def run
|
8
|
-
1
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
test 'should register a command' do
|
15
|
-
assert_difference('commands.length', 1) do
|
16
|
-
define_test_command
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|