rhc 1.27.4 → 1.28.5
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/autocomplete/rhc_bash +87 -23
- data/lib/rhc/auth.rb +1 -0
- data/lib/rhc/auth/basic.rb +8 -0
- data/lib/rhc/auth/token.rb +16 -7
- data/lib/rhc/auth/x509.rb +53 -0
- data/lib/rhc/autocomplete.rb +8 -0
- data/lib/rhc/autocomplete_templates/bash.erb +4 -4
- data/lib/rhc/commands/app.rb +21 -8
- data/lib/rhc/commands/base.rb +16 -2
- data/lib/rhc/commands/env.rb +2 -1
- data/lib/rhc/commands/region.rb +27 -0
- data/lib/rhc/commands/server.rb +19 -10
- data/lib/rhc/commands/sshkey.rb +1 -0
- data/lib/rhc/config.rb +1 -0
- data/lib/rhc/context_helper.rb +13 -11
- data/lib/rhc/exceptions.rb +12 -0
- data/lib/rhc/helpers.rb +26 -7
- data/lib/rhc/output_helpers.rb +21 -0
- data/lib/rhc/rest.rb +1 -0
- data/lib/rhc/rest/application.rb +5 -0
- data/lib/rhc/rest/client.rb +21 -0
- data/lib/rhc/rest/domain.rb +2 -1
- data/lib/rhc/rest/membership.rb +2 -0
- data/lib/rhc/rest/mock.rb +31 -0
- data/lib/rhc/rest/region.rb +25 -0
- data/lib/rhc/servers.rb +6 -4
- data/lib/rhc/wizard.rb +17 -5
- data/spec/rhc/auth_spec.rb +77 -5
- data/spec/rhc/command_spec.rb +14 -2
- data/spec/rhc/commands/app_spec.rb +14 -1
- data/spec/rhc/commands/env_spec.rb +2 -2
- data/spec/rhc/commands/member_spec.rb +7 -0
- data/spec/rhc/commands/region_spec.rb +50 -0
- data/spec/rhc/helpers_spec.rb +14 -0
- data/spec/rhc/wizard_spec.rb +31 -0
- metadata +10 -5
data/spec/rhc/helpers_spec.rb
CHANGED
|
@@ -214,6 +214,20 @@ describe AllRhcHelpers do
|
|
|
214
214
|
end
|
|
215
215
|
end
|
|
216
216
|
|
|
217
|
+
context "with a missing client key file" do
|
|
218
|
+
context "on the command line" do
|
|
219
|
+
let(:arguments){ ['help', '--ssl-client-key-file=not_a_file'] }
|
|
220
|
+
it{ expect{ run }.to exit_with_code(1) }
|
|
221
|
+
it{ run_output.should match("The key 'not_a_file' cannot be loaded: No such") }
|
|
222
|
+
end
|
|
223
|
+
context "via the config" do
|
|
224
|
+
before{ base_config{ |c, d| d.add 'ssl_client_key_file', 'not_a_file' } }
|
|
225
|
+
let(:arguments){ ['help'] }
|
|
226
|
+
it{ expect{ run }.to exit_with_code(1) }
|
|
227
|
+
it{ run_output.should match("The key 'not_a_file' cannot be loaded: No such") }
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
217
231
|
context 'with a valid --ssl-version' do
|
|
218
232
|
let(:arguments){ ['help', '--ssl-version=sslv3'] }
|
|
219
233
|
|
data/spec/rhc/wizard_spec.rb
CHANGED
|
@@ -103,6 +103,17 @@ describe RHC::Wizard do
|
|
|
103
103
|
end
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
+
describe "#core_auth" do
|
|
107
|
+
subject{ described_class.new(config, options) }
|
|
108
|
+
|
|
109
|
+
it "should use x509 if certificates are present" do
|
|
110
|
+
options.should_receive(:ssl_client_cert_file).and_return("a cert")
|
|
111
|
+
options.should_receive(:ssl_client_key_file).and_return("a key")
|
|
112
|
+
RHC::Auth::X509.should_receive(:new).exactly(1).times.with(options)
|
|
113
|
+
subject.send(:core_auth)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
106
117
|
describe "#login_stage" do
|
|
107
118
|
let(:user){ 'test_user' }
|
|
108
119
|
let(:password){ 'test pass' }
|
|
@@ -234,6 +245,23 @@ describe RHC::Wizard do
|
|
|
234
245
|
options.token.should == token
|
|
235
246
|
end
|
|
236
247
|
end
|
|
248
|
+
|
|
249
|
+
context "when the user doesn't want to use tokens" do
|
|
250
|
+
let(:default_options){ {:rhlogin => user, :password => password, :server => server, :use_authorization_tokens => false, :create_token => false} }
|
|
251
|
+
before do
|
|
252
|
+
subject.should_receive(:new_client_for_options).ordered.and_return(rest_client)
|
|
253
|
+
rest_client.should_receive(:api).ordered
|
|
254
|
+
rest_client.should_receive(:user).ordered.and_return(user_obj)
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
it "should skip token generation" do
|
|
258
|
+
subject.should_receive(:say).with(/Skipping token generation/)
|
|
259
|
+
subject.should_receive(:agree).never
|
|
260
|
+
|
|
261
|
+
subject.send(:login_stage).should be_true
|
|
262
|
+
options.token.should be_nil
|
|
263
|
+
end
|
|
264
|
+
end
|
|
237
265
|
end
|
|
238
266
|
end
|
|
239
267
|
|
|
@@ -719,6 +747,9 @@ EOF
|
|
|
719
747
|
def type=(type)
|
|
720
748
|
@table[:type] = type
|
|
721
749
|
end
|
|
750
|
+
def is_ssh?
|
|
751
|
+
type != 'krb5-principal'
|
|
752
|
+
end
|
|
722
753
|
end
|
|
723
754
|
|
|
724
755
|
def get_mock_key_data
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rhc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 109
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 1.
|
|
8
|
+
- 28
|
|
9
|
+
- 5
|
|
10
|
+
version: 1.28.5
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Red Hat
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2014-
|
|
18
|
+
date: 2014-08-02 00:00:00 Z
|
|
19
19
|
dependencies:
|
|
20
20
|
- !ruby/object:Gem::Dependency
|
|
21
21
|
name: net-ssh
|
|
@@ -289,6 +289,7 @@ files:
|
|
|
289
289
|
- lib/rhc/commands/ssh.rb
|
|
290
290
|
- lib/rhc/commands/apps.rb
|
|
291
291
|
- lib/rhc/commands/alias.rb
|
|
292
|
+
- lib/rhc/commands/region.rb
|
|
292
293
|
- lib/rhc/commands/authorization.rb
|
|
293
294
|
- lib/rhc/commands/sshkey.rb
|
|
294
295
|
- lib/rhc/commands/app.rb
|
|
@@ -320,6 +321,7 @@ files:
|
|
|
320
321
|
- lib/rhc/rest/api.rb
|
|
321
322
|
- lib/rhc/rest/client.rb
|
|
322
323
|
- lib/rhc/rest/alias.rb
|
|
324
|
+
- lib/rhc/rest/region.rb
|
|
323
325
|
- lib/rhc/rest/authorization.rb
|
|
324
326
|
- lib/rhc/rest/mock.rb
|
|
325
327
|
- lib/rhc/rest/httpclient.rb
|
|
@@ -330,6 +332,7 @@ files:
|
|
|
330
332
|
- lib/rhc/vendor/zliby.rb
|
|
331
333
|
- lib/rhc/vendor/sshkey.rb
|
|
332
334
|
- lib/rhc/auth/token.rb
|
|
335
|
+
- lib/rhc/auth/x509.rb
|
|
333
336
|
- lib/rhc/auth/basic.rb
|
|
334
337
|
- lib/rhc/auth/token_store.rb
|
|
335
338
|
- lib/rhc/helpers.rb
|
|
@@ -372,6 +375,7 @@ files:
|
|
|
372
375
|
- spec/rhc/commands/app_spec.rb
|
|
373
376
|
- spec/rhc/commands/snapshot_spec.rb
|
|
374
377
|
- spec/rhc/commands/ssh_spec.rb
|
|
378
|
+
- spec/rhc/commands/region_spec.rb
|
|
375
379
|
- spec/rhc/commands/tail_spec.rb
|
|
376
380
|
- spec/rhc/commands/setup_spec.rb
|
|
377
381
|
- spec/rhc/commands/alias_spec.rb
|
|
@@ -471,6 +475,7 @@ test_files:
|
|
|
471
475
|
- spec/rhc/commands/app_spec.rb
|
|
472
476
|
- spec/rhc/commands/snapshot_spec.rb
|
|
473
477
|
- spec/rhc/commands/ssh_spec.rb
|
|
478
|
+
- spec/rhc/commands/region_spec.rb
|
|
474
479
|
- spec/rhc/commands/tail_spec.rb
|
|
475
480
|
- spec/rhc/commands/setup_spec.rb
|
|
476
481
|
- spec/rhc/commands/alias_spec.rb
|