rhc 1.29.7 → 1.30.2
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 +7 -7
- data/lib/rhc/helpers.rb +12 -1
- data/spec/rhc/helpers_spec.rb +11 -0
- metadata +5 -5
data/autocomplete/rhc_bash
CHANGED
@@ -8,7 +8,7 @@ _rhc()
|
|
8
8
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
9
9
|
if [ $COMP_CWORD -eq 1 ]; then
|
10
10
|
if [[ "$cur" == -* ]]; then
|
11
|
-
opts="--always-prefix --clean --config --debug --insecure --limit --mock --noprompt --password --raw --rhlogin --server --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --token"
|
11
|
+
opts="--always-prefix --clean --config --debug --header --insecure --limit --mock --noprompt --password --raw --rhlogin --server --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --token"
|
12
12
|
elif [ -z $cur ]; then
|
13
13
|
opts="account alias alias-add alias-delete-cert alias-list alias-remove alias-update-cert app app-configure app-create app-delete app-deploy app-force-stop app-reload app-restart app-scale-down app-scale-up app-show app-start app-stop app-tidy apps authorization authorization-add authorization-delete authorization-delete-all authorization-list cartridge cartridge-add cartridge-list cartridge-reload cartridge-remove cartridge-restart cartridge-scale cartridge-show cartridge-start cartridge-status cartridge-stop cartridge-storage deployment deployment-activate deployment-list deployment-show domain domain-configure domain-create domain-delete domain-leave domain-list domain-rename domain-show env env-list env-set env-show env-unset git-clone help logout member member-add member-list member-remove member-update port-forward region region-list scp server server-add server-configure server-list server-remove server-show server-status server-use setup snapshot snapshot-restore snapshot-save ssh sshkey sshkey-add sshkey-list sshkey-remove sshkey-show tail team team-create team-delete team-leave team-list team-show threaddump"
|
14
14
|
else
|
@@ -86,7 +86,7 @@ _rhc()
|
|
86
86
|
|
87
87
|
"rhc add-server")
|
88
88
|
if [[ "$cur" == -* ]]; then
|
89
|
-
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
89
|
+
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
90
90
|
else
|
91
91
|
opts=""
|
92
92
|
fi
|
@@ -774,7 +774,7 @@ _rhc()
|
|
774
774
|
|
775
775
|
"rhc configure-server")
|
776
776
|
if [[ "$cur" == -* ]]; then
|
777
|
-
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
777
|
+
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
778
778
|
else
|
779
779
|
opts=""
|
780
780
|
fi
|
@@ -1566,7 +1566,7 @@ _rhc()
|
|
1566
1566
|
|
1567
1567
|
"rhc server add")
|
1568
1568
|
if [[ "$cur" == -* ]]; then
|
1569
|
-
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
1569
|
+
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
1570
1570
|
else
|
1571
1571
|
opts=""
|
1572
1572
|
fi
|
@@ -1574,7 +1574,7 @@ _rhc()
|
|
1574
1574
|
|
1575
1575
|
"rhc server configure")
|
1576
1576
|
if [[ "$cur" == -* ]]; then
|
1577
|
-
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
1577
|
+
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
1578
1578
|
else
|
1579
1579
|
opts=""
|
1580
1580
|
fi
|
@@ -1622,7 +1622,7 @@ _rhc()
|
|
1622
1622
|
|
1623
1623
|
"rhc server-add")
|
1624
1624
|
if [[ "$cur" == -* ]]; then
|
1625
|
-
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
1625
|
+
opts="--insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
1626
1626
|
else
|
1627
1627
|
opts=""
|
1628
1628
|
fi
|
@@ -1630,7 +1630,7 @@ _rhc()
|
|
1630
1630
|
|
1631
1631
|
"rhc server-configure")
|
1632
1632
|
if [[ "$cur" == -* ]]; then
|
1633
|
-
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-version --timeout --use --use-authorization-tokens"
|
1633
|
+
opts="--hostname --insecure --nickname --no-insecure --no-use-authorization-tokens --rhlogin --server --skip-wizard --ssl-ca-file --ssl-client-cert-file --ssl-client-key-file --ssl-version --timeout --use --use-authorization-tokens"
|
1634
1634
|
else
|
1635
1635
|
opts=""
|
1636
1636
|
fi
|
data/lib/rhc/helpers.rb
CHANGED
@@ -113,6 +113,7 @@ module RHC
|
|
113
113
|
global_option '--server HOSTNAME', String, 'An OpenShift server hostname (default: openshift.redhat.com)'
|
114
114
|
global_option '-k', '--insecure', "Allow insecure SSL connections. Potential security risk.", :hide => true
|
115
115
|
|
116
|
+
global_option '--header HEADER', String,"Custom header to pass to server", :hide => true
|
116
117
|
global_option '--limit INTEGER', Integer, "Maximum number of simultaneous operations to execute.", :hide => true
|
117
118
|
global_option '--raw', "Do not format the output from the requested operations.", :hide => true
|
118
119
|
global_option '--always-prefix', "Include the gear prefix on all output from the server.", :hide => true
|
@@ -199,11 +200,21 @@ module RHC
|
|
199
200
|
return nil if token_store_user_key.nil?
|
200
201
|
token_store.get(token_store_user_key, options.server)
|
201
202
|
end
|
203
|
+
|
204
|
+
def parse_headers(headers)
|
205
|
+
Hash[
|
206
|
+
Array(headers).map do |header|
|
207
|
+
key, value = header.split(/: */, 2)
|
208
|
+
[key, value || ""] if key.presence
|
209
|
+
end.compact
|
210
|
+
]
|
211
|
+
end
|
202
212
|
|
203
213
|
def client_from_options(opts)
|
204
214
|
RHC::Rest::Client.new({
|
205
215
|
:url => openshift_rest_endpoint.to_s,
|
206
216
|
:debug => options.debug,
|
217
|
+
:headers => parse_headers(options.header),
|
207
218
|
:timeout => options.timeout,
|
208
219
|
:warn => BOUND_WARNING,
|
209
220
|
}.merge!(ssl_options).merge!(opts))
|
@@ -433,7 +444,7 @@ module RHC
|
|
433
444
|
debug("Checking for #{host} from Resolv::Hosts: #{result.inspect}") if debug?
|
434
445
|
result
|
435
446
|
rescue => e
|
436
|
-
debug "
|
447
|
+
debug "Application could not be resolved through Hosts file: #{e.message}(#{e.class})\n #{e.backtrace.join("\n ")}\n Attempting DNS resolution."
|
437
448
|
end
|
438
449
|
end
|
439
450
|
end
|
data/spec/rhc/helpers_spec.rb
CHANGED
@@ -45,6 +45,17 @@ describe AllRhcHelpers do
|
|
45
45
|
|
46
46
|
it("should decode json"){ subject.decode_json("{\"a\" : 1}").should == {'a' => 1} }
|
47
47
|
|
48
|
+
it("should parse custom headers") {
|
49
|
+
subject.parse_headers(nil).should == {}
|
50
|
+
subject.parse_headers("").should == {}
|
51
|
+
subject.parse_headers("A").should == {"A" => ""}
|
52
|
+
subject.parse_headers("A:B").should == {"A" => "B"}
|
53
|
+
subject.parse_headers("A: B").should == {"A" => "B"}
|
54
|
+
subject.parse_headers(["A: B", "A: C"]).should == {"A" => "C"}
|
55
|
+
subject.parse_headers(["A: B", "C: D"]).should == {"A" => "B", "C" => "D"}
|
56
|
+
subject.parse_headers(["A:B:C"]).should == {"A" => "B:C"}
|
57
|
+
}
|
58
|
+
|
48
59
|
shared_examples_for "colorized output" do
|
49
60
|
it("should be colorized") do
|
50
61
|
message = "this is #{_color} -"
|
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: 107
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 30
|
9
|
+
- 2
|
10
|
+
version: 1.30.2
|
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-09-
|
18
|
+
date: 2014-09-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: net-ssh
|