1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Bug #1274: Fix internal server error when wrong auth with opennebula auth

It was caused by an attempt of logging when no logger had been passed to CloudAuth.

Affected Sunstone only.
(cherry picked from commit 97b62f8857a9064eb534041c09b742779cf79dfd)
This commit is contained in:
Hector Sanjuan 2012-09-17 13:46:22 +02:00 committed by Ruben S. Montero
parent a2e61867e7
commit 0e8bd80f87
2 changed files with 7 additions and 5 deletions

View File

@ -26,8 +26,10 @@ module OpenNebulaCloudAuth
rc = user.info
if OpenNebula.is_error?(rc)
logger.error { "User #{username} could not be authenticated" }
logger.error { rc.message }
if logger
logger.error{ "User #{username} could not be authenticated"}
logger.error { rc.message }
end
return nil
end
@ -36,4 +38,4 @@ module OpenNebulaCloudAuth
return nil
end
end
end

View File

@ -87,7 +87,7 @@ enable_logging SUNSTONE_LOG, settings.config[:debug_level].to_i
begin
ENV["ONE_CIPHER_AUTH"] = SUNSTONE_AUTH
cloud_auth = CloudAuth.new(settings.config)
cloud_auth = CloudAuth.new(settings.config, settings.logger)
rescue => e
settings.logger.error {
"Error initializing authentication system" }
@ -120,8 +120,8 @@ helpers do
begin
result = settings.cloud_auth.auth(request.env, params)
rescue Exception => e
error 500, ""
logger.error { e.message }
return [500, ""]
end
if result.nil?