right_chimp 2.2.2 → 2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +5 -1
- data/Gemfile.lock +5 -5
- data/INSTALL +15 -6
- data/lib/right_chimp/resources/connection.rb +18 -7
- data/lib/right_chimp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdeacec528b901c2b6941a6e3506a76cb113a72e
|
4
|
+
data.tar.gz: f463c5a7fdf2f249a444ff55ee6348024a20c6ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2e67fa34f3db3ef97766c951af955e322870a72a07b380b527e95a43054521857dd0aa50c15a4c97844e754ac943c88d3f6bd15c7a6bcaade18f6aac114c91
|
7
|
+
data.tar.gz: b0c616182b48b6ee7f378e73b0aefbf38e8fdaf7025739ddb97f5e9d3a1bd845ec7fdd15b0b778cef1d4b980612ab0bd938495e8b1e88da945bd163fcd231f6c
|
data/CHANGES
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
Version 2.3
|
2
|
+
-----------
|
3
|
+
* Feature: Allow authentication via OAuth token.
|
4
|
+
|
1
5
|
Version 2.2.2
|
2
6
|
-------------
|
3
7
|
* Feature: Now compatible with RightLink10 task states.
|
4
|
-
* Bugfix: Fixes standalone retry execution.
|
8
|
+
* Bugfix: Fixes standalone retry execution.
|
5
9
|
|
6
10
|
Version 2.2
|
7
11
|
--------------
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
right_chimp (2.
|
4
|
+
right_chimp (2.3)
|
5
5
|
highline (~> 1.7.2)
|
6
6
|
nokogiri (~> 1.6.7.1)
|
7
7
|
progressbar (~> 0.11.0)
|
@@ -16,14 +16,14 @@ GEM
|
|
16
16
|
coderay (1.1.1)
|
17
17
|
debug_inspector (0.0.2)
|
18
18
|
diff-lcs (1.2.5)
|
19
|
-
domain_name (0.5.
|
19
|
+
domain_name (0.5.20161021)
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
21
21
|
highline (1.7.8)
|
22
22
|
http-cookie (1.0.3)
|
23
23
|
domain_name (~> 0.5)
|
24
24
|
json (1.8.3)
|
25
25
|
method_source (0.8.2)
|
26
|
-
mime-types (
|
26
|
+
mime-types (2.99.3)
|
27
27
|
mini_portile2 (2.0.0)
|
28
28
|
netrc (0.11.0)
|
29
29
|
nokogiri (1.6.7.2)
|
@@ -41,9 +41,9 @@ GEM
|
|
41
41
|
http-cookie (>= 1.0.2, < 2.0)
|
42
42
|
mime-types (>= 1.16, < 3.0)
|
43
43
|
netrc (~> 0.7)
|
44
|
-
right_api_client (1.6.
|
44
|
+
right_api_client (1.6.2)
|
45
45
|
json (~> 1.0)
|
46
|
-
mime-types (~>
|
46
|
+
mime-types (~> 2.0)
|
47
47
|
rest-client (~> 1.6)
|
48
48
|
rspec (3.5.0)
|
49
49
|
rspec-core (~> 3.5.0)
|
data/INSTALL
CHANGED
@@ -12,21 +12,30 @@ creds. First create a directory for the configuration file:
|
|
12
12
|
|
13
13
|
mkdir ~/.rest_connection
|
14
14
|
|
15
|
-
Next create the configuration file. Name it rest_api_config.yaml and place it in the
|
16
|
-
.rest_connection folder. Use the following YAML as a template, replacing <email>, <password>
|
15
|
+
Next create the configuration file. Name it rest_api_config.yaml and place it in the
|
16
|
+
.rest_connection folder. Use the following YAML as a template, replacing <email>, <password>
|
17
17
|
and <account> with your email address, RightScale password, and account number.
|
18
18
|
|
19
|
-
---
|
20
|
-
:ssh_keys:
|
19
|
+
---
|
20
|
+
:ssh_keys:
|
21
21
|
- ~/.ssh/id_rsa
|
22
22
|
:pass: <password>
|
23
23
|
:user: <email>
|
24
24
|
:api_url: https://my.rightscale.com/api/acct/<account>
|
25
|
-
:common_headers:
|
26
|
-
X_API_VERSION: "1.0"
|
27
25
|
|
28
26
|
Now you're ready to run a test query. The following chimp command should return
|
29
27
|
a list of all the operational servers in your account:
|
30
28
|
|
31
29
|
chimp --tag="rs_monitoring:state=active"
|
32
30
|
|
31
|
+
RIGHTSCALE OAUTH SPECIFIC NOTES
|
32
|
+
--------------------------------
|
33
|
+
|
34
|
+
rest_api_config.yaml should look like
|
35
|
+
|
36
|
+
:ssh_keys:
|
37
|
+
- ~/.ssh/id_rsa
|
38
|
+
:user: <email>
|
39
|
+
:refresh_token: <refresh_token>
|
40
|
+
:api_url: https://us-3.rightscale.com
|
41
|
+
:account: <account>
|
@@ -51,10 +51,17 @@ module Chimp
|
|
51
51
|
@endpoint = URI.parse(creds[:api_url]).host
|
52
52
|
|
53
53
|
Log.debug "Logging into Api 1.5 right_api_client"
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
if creds[:refresh_token] then
|
55
|
+
# no account id extraction, must be specified in config file
|
56
|
+
# refresh_token must be specified in config
|
57
|
+
@client = RightApi::Client.new(refresh_token: creds[:refresh_token],
|
58
|
+
account_id: creds[:account], api_url: creds[:api_url],
|
59
|
+
timeout: 60, enable_retry: true)
|
60
|
+
else
|
61
|
+
@client = RightApi::Client.new(email: creds[:user], password: creds[:pass],
|
62
|
+
account_id: creds[:account], api_url: creds[:api_url],
|
63
|
+
timeout: 60, enable_retry: true)
|
64
|
+
end
|
58
65
|
rescue
|
59
66
|
puts "##############################################################################"
|
60
67
|
puts "Error: "
|
@@ -125,7 +132,6 @@ module Chimp
|
|
125
132
|
# Provides a way to make an api1.6 call directly
|
126
133
|
#
|
127
134
|
def Connection.api16_call(query)
|
128
|
-
|
129
135
|
Thread.current[:retry] = true
|
130
136
|
Thread.current[:response] = nil
|
131
137
|
retries = 5
|
@@ -133,8 +139,13 @@ module Chimp
|
|
133
139
|
sleep_for = 20
|
134
140
|
|
135
141
|
begin
|
136
|
-
get
|
137
|
-
|
142
|
+
get = Net::HTTP::Get.new(query)
|
143
|
+
if @client.access_token
|
144
|
+
# auth using oauth access token
|
145
|
+
get['Authorization'] = 'Bearer ' + @client.access_token
|
146
|
+
else
|
147
|
+
get['Cookie'] = @client.cookies.map { |key, value| "%s=%s" % [key, value] }.join(';')
|
148
|
+
end
|
138
149
|
get['X-Api_Version'] = '1.6'
|
139
150
|
get['X-Account'] = @client.account_id
|
140
151
|
|
data/lib/right_chimp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_chimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: '2.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RightScale Operations
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|