[PATCH aeolus-cli] Catch 401 Unauthorized response and display a more helpful error

Matt Wagner matt.wagner at redhat.com
Tue Dec 13 21:58:48 UTC 2011


Resolves https://bugzilla.redhat.com/show_bug.cgi?id=767342
---
 lib/aeolus_cli/command/base_command.rb |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/aeolus_cli/command/base_command.rb b/lib/aeolus_cli/command/base_command.rb
index d6afc6f..9c79f53 100644
--- a/lib/aeolus_cli/command/base_command.rb
+++ b/lib/aeolus_cli/command/base_command.rb
@@ -90,7 +90,10 @@ module Aeolus
         code = doc.xpath("/error/code").text
         message = doc.xpath("/error/message").text
 
-        if message.to_s.empty?
+        if e.is_a?(ActiveResource::UnauthorizedAccess)
+          code = "Unauthorized"
+          message = "Conductor rejected the user credentials from ~/.aeolus-cli"
+        elsif message.to_s.empty?
           case code
             when "BuildDeleteFailure" : message = "An error occured when deleting the Build from the Image Warehouse"
             when "BuildNotFound" : message = "Could not find the specified Build"
@@ -189,4 +192,4 @@ module Aeolus
       end
     end
   end
-end
\ No newline at end of file
+end
-- 
1.7.6.4




More information about the aeolus-devel mailing list