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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f27bf83c2b327b366e844aeb2a3d3f6734689870
4
- data.tar.gz: 8184ccc9096fbc3117807938aca84b0c71224d49
3
+ metadata.gz: 64b6a83d3028b61fae3934610acd34693072a1ba
4
+ data.tar.gz: 3aaca9503b8091d98c4e896b733bbf4e50dc3434
5
5
  SHA512:
6
- metadata.gz: 961e3af440fb8e7614d47f52d60ab5ec05af1563a07e28f702f78dc25414016252b14aa580ee16c009844f9db2be737b3c7bef1418ee9db7e20eac55383dd8e8
7
- data.tar.gz: 0c61aef7964334ececb2cd7c57351fec449a20638bbc30238badeaf4ca051fe076fcd8165d3445b23f3ebb602bd2adcbb31a6488b9e639717d20e546bab0d47b
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (2.3.1)
4
+ brightbox-cli (2.3.2)
5
5
  fog-brightbox (>= 0.9.0)
6
6
  gli (~> 2.12.0)
7
7
  highline (~> 1.6.0)
@@ -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 = client_alias
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
- flush_access_token!
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}"
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.3.1" unless defined?(Brightbox::VERSION)
2
+ VERSION = "2.3.2" unless defined?(Brightbox::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach