brightbox-cli 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/lib/brightbox-cli/config/authentication_tokens.rb +20 -0
- data/lib/brightbox-cli/config/sections.rb +4 -2
- data/lib/brightbox-cli/config.rb +2 -2
- data/lib/brightbox-cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64b6a83d3028b61fae3934610acd34693072a1ba
|
4
|
+
data.tar.gz: 3aaca9503b8091d98c4e896b733bbf4e50dc3434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44ceff7d8ffe9093fc1237ac5838664a961b8c704ea55569b107109f924251bcb8cb36ac7932b7ca5f06619e1c33c3251a35ad28354e4ec51d6cc192e2b13dd0
|
7
|
+
data.tar.gz: 6c57722ae172093641fedae161d45c0520811f495c29407718d1839dd3eb0fee64e83f626243c8cfe9f5a2eb0cd0694052fabf7315c4400db416f7134d59f41f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
### v2.3.2 / 2015-10-26
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.3.1...v2.3.2)
|
4
|
+
|
5
|
+
Bug fixes:
|
6
|
+
|
7
|
+
* Fix issue when `login` command prompt twice for password (or prompt once even
|
8
|
+
when already supplied) due to reusing cached but expired refresh token.
|
9
|
+
|
1
10
|
### v2.3.1 / 2015-10-26
|
2
11
|
|
3
12
|
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.3.0...v2.3.1)
|
data/Gemfile.lock
CHANGED
@@ -224,15 +224,35 @@ module Brightbox
|
|
224
224
|
f.write token
|
225
225
|
end
|
226
226
|
# Move process version into place
|
227
|
+
debug "Saving #{token} to #{filename}"
|
227
228
|
FileUtils.mv filename + ".#{$PID}", filename
|
228
229
|
end
|
229
230
|
|
230
231
|
def cached_access_token
|
231
232
|
File.open(access_token_filename, "r") { |fl| fl.read.chomp }
|
233
|
+
rescue Errno::ENOENT
|
234
|
+
nil
|
232
235
|
end
|
233
236
|
|
234
237
|
def cached_refresh_token
|
235
238
|
File.open(refresh_token_filename, "r") { |fl| fl.read.chomp }
|
239
|
+
rescue Errno::ENOENT
|
240
|
+
nil
|
241
|
+
end
|
242
|
+
|
243
|
+
def remove_cached_tokens!
|
244
|
+
remove_access_token!
|
245
|
+
remove_refresh_token!
|
246
|
+
end
|
247
|
+
|
248
|
+
def remove_access_token!
|
249
|
+
@access_token = nil
|
250
|
+
FileUtils.rm(access_token_filename) if File.exist?(access_token_filename)
|
251
|
+
end
|
252
|
+
|
253
|
+
def remove_refresh_token!
|
254
|
+
@refresh_token = nil
|
255
|
+
FileUtils.rm(refresh_token_filename) if File.exist?(refresh_token_filename)
|
236
256
|
end
|
237
257
|
|
238
258
|
private
|
@@ -33,14 +33,16 @@ module Brightbox
|
|
33
33
|
|
34
34
|
dirty!
|
35
35
|
|
36
|
-
self.client_name =
|
36
|
+
self.client_name = config_alias
|
37
|
+
|
38
|
+
debug "Using #{client_name}"
|
37
39
|
|
38
40
|
# Renew tokens via config...
|
39
41
|
#
|
40
42
|
# Part of the "login" behaviour is to always refresh them
|
41
43
|
#
|
42
44
|
begin
|
43
|
-
|
45
|
+
remove_cached_tokens!
|
44
46
|
renew_tokens(:client_name => config_alias, :password => password)
|
45
47
|
rescue => e
|
46
48
|
error "Something went wrong trying to refresh new tokens #{e.message}"
|
data/lib/brightbox-cli/config.rb
CHANGED
@@ -85,9 +85,9 @@ module Brightbox
|
|
85
85
|
#
|
86
86
|
def debug_tokens
|
87
87
|
if ENV["DEBUG"]
|
88
|
-
debug "Access token: #{access_token}"
|
88
|
+
debug "Access token: #{access_token} (#{cached_access_token})"
|
89
89
|
if using_application?
|
90
|
-
debug "Refresh token: #{refresh_token}"
|
90
|
+
debug "Refresh token: #{refresh_token} (#{cached_refresh_token}))"
|
91
91
|
else
|
92
92
|
debug "Refresh token: <NOT EXPECTED FOR CLIENT>"
|
93
93
|
end
|