engineyard 2.0.0.pre4 → 2.0.0.pre5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,12 +25,21 @@ module EY
25
25
  @ui = ui
26
26
  EY::CloudClient.endpoint = endpoint
27
27
 
28
- @token = token # specified on command line
29
- @token ||= ENV['ENGINEYARD_API_TOKEN'] if ENV['ENGINEYARD_API_TOKEN']
30
- @token ||= EY::EYRC.load.api_token
31
- @token ||= self.class.authenticate(ui)
32
-
33
- unless @token
28
+ # If the token is specified, we don't ask for authentication when
29
+ # the token is reject, we just exit.
30
+ if @token = token
31
+ @specified = true
32
+ @source = 'token from --api-token'
33
+ elsif @token = ENV['ENGINEYARD_API_TOKEN']
34
+ @specified = true
35
+ @source = 'token from $ENGINEYARD_API_TOKEN'
36
+ elsif @token = EY::EYRC.load.api_token
37
+ @specified = false
38
+ @source = "api_token in #{EY::EYRC.load.path}"
39
+ elsif @token = self.class.authenticate(ui)
40
+ @specified = false
41
+ @source = 'credentials'
42
+ else
34
43
  raise EY::Error, "Sorry, we couldn't get your API token."
35
44
  end
36
45
 
@@ -50,10 +59,15 @@ module EY
50
59
  super
51
60
  end
52
61
  rescue EY::CloudClient::InvalidCredentials
53
- ui.warn "Authentication failed."
54
- @token = self.class.authenticate(@ui)
55
- @api = EY::CloudClient.new(@token, @ui)
56
- retry
62
+ if @specified
63
+ ui.error "Authentication failed: Invalid #{@source}."
64
+ exit(255)
65
+ else
66
+ ui.warn "Authentication failed: Invalid #{@source}. Retrying..."
67
+ @token = self.class.authenticate(@ui)
68
+ @api = EY::CloudClient.new(@token, @ui)
69
+ retry
70
+ end
57
71
  end
58
72
 
59
73
  end
@@ -23,12 +23,12 @@ module EY
23
23
  end
24
24
 
25
25
  def put_up_maintenance_page(&block)
26
- @command = @adapter.enable_maintenance_page(&block)
26
+ @command = @adapter.enable_maintenance(&block)
27
27
  self
28
28
  end
29
29
 
30
30
  def take_down_maintenance_page(&block)
31
- @command = @adapter.disable_maintenance_page(&block)
31
+ @command = @adapter.disable_maintenance(&block)
32
32
  self
33
33
  end
34
34
 
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '2.0.0.pre4'
2
+ VERSION = '2.0.0.pre5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre4
4
+ version: 2.0.0.pre5.1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-13 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - '='
100
100
  - !ruby/object:Gem::Version
101
- version: 2.0.0.pre4
101
+ version: 2.0.0.pre5
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 2.0.0.pre4
109
+ version: 2.0.0.pre5
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: engineyard-cloud-client
112
112
  requirement: !ruby/object:Gem::Requirement