Merge lp:~facundo/ubuntuone-client/discriminate-auth-error into lp:ubuntuone-client

Proposed by Facundo Batista on 2009-10-16
Status: Merged
Approved by: dobey on 2009-10-16
Approved revision: 258
Merged at revision: not available
Proposed branch: lp:~facundo/ubuntuone-client/discriminate-auth-error
Merge into: lp:ubuntuone-client
Diff against target: 37 lines
1 file modified
ubuntuone/syncdaemon/action_queue.py (+14/-3)
To merge this branch: bzr merge lp:~facundo/ubuntuone-client/discriminate-auth-error
Reviewer Review Type Date Requested Status
dobey (community) Approve on 2009-10-16
John Lenton 2009-10-16 Approve on 2009-10-16
Review via email: mp+13490@code.launchpad.net

Commit message

Distinguish between Auth failure and other errors.

To post a comment you must log in.
Facundo Batista (facundo) wrote :

Distinguish between Auth failure and other errors.

Now, we only go to AUTH_ERROR state if the Auth effectively failed; if something else happens, we go to unknown error, not provoking the applet to drop the token.

Here are snippets of the log for each situation, tested IRL with this changes (and lp:~facundo/ubuntuone-storage-protocol/discriminate_auth_error also applied):

Authentication OK:

  State - DEBUG - START_SET_CAPABILITIES --[SYS_SET_CAPABILITIES_OK]--> START_AUTHENTICATING
  EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': <NonActiveConnectedSDState START_AUTHENTICATING>}
  ActionQueue - INFO - Oauth OK
  EQ - DEBUG - push_event: SYS_OAUTH_OK, args:(), kw:{}

Authentication FAIL:

  State - DEBUG - START_SET_CAPABILITIES_WITH_METAQ --[SYS_SET_CAPABILITIES_OK]--> START_AUTHENTICATING_WITH_METAQ
  EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': <SyncDaemonState START_AUTHENTICATING_WITH_METAQ>}
  ActionQueue - ERROR - OAuth failed: AUTHENTICATION_FAILED
  EQ - DEBUG - push_event: SYS_OAUTH_ERROR, args:(), kw:{'error': 'AUTHENTICATION_FAILED'}
  State - DEBUG - Event arrived: cancelling timeout watchdog
  ActionQueue - DEBUG - disconnected
  State - DEBUG - START_AUTHENTICATING_WITH_METAQ --[SYS_OAUTH_ERROR]--> AUTH_FAILED
  EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': <AQErrorState AUTH_FAILED>}

Server answered INTERNAL_ERROR:

  State - DEBUG - START_SET_CAPABILITIES_WITH_METAQ --[SYS_SET_CAPABILITIES_OK]--> START_AUTHENTICATING_WITH_METAQ
  EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': <SyncDaemonState START_AUTHENTICATING_WITH_METAQ>}
  ActionQueue - ERROR - StorageRequestError during OAuth: INTERNAL_ERROR
  EQ - DEBUG - push_event: SYS_UNKNOWN_ERROR, args:(), kw:{}
  State - DEBUG - Event arrived: cancelling timeout watchdog
  EQ - DEBUG - push_event: SYS_DISCONNECT, args:(), kw:{}
  HQ - INFO - HashQueue: _hasher stopped
  DBus - INFO - Shuttingdown DBusInterface!
  ActionQueue - DEBUG - disconnected
  State - DEBUG - START_AUTHENTICATING_WITH_METAQ --[SYS_UNKNOWN_ERROR]--> UNKNOWN_ERROR
  EQ - DEBUG - push_event: SYS_STATE_CHANGED, args:(), kw:{'state': <AQErrorState UNKNOWN_ERROR>}

John Lenton (chipaca) wrote :

Awesome.

review: Approve
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/syncdaemon/action_queue.py'
--- ubuntuone/syncdaemon/action_queue.py 2009-10-09 08:19:05 +0000
+++ ubuntuone/syncdaemon/action_queue.py 2009-10-16 17:10:21 +0000
@@ -44,7 +44,7 @@
4444
45from oauth import oauth45from oauth import oauth
46from ubuntuone.storageprotocol.context import get_ssl_context46from ubuntuone.storageprotocol.context import get_ssl_context
47from ubuntuone.storageprotocol import protocol_pb247from ubuntuone.storageprotocol import protocol_pb2, request
48from ubuntuone.storageprotocol.client import ThrottlingStorageClient, \48from ubuntuone.storageprotocol.client import ThrottlingStorageClient, \
49 ThrottlingStorageClientFactory49 ThrottlingStorageClientFactory
50from ubuntuone.syncdaemon.logger import mklog, TRACE50from ubuntuone.syncdaemon.logger import mklog, TRACE
@@ -975,11 +975,22 @@
975 client = self.client975 client = self.client
976 try:976 try:
977 yield client.oauth_authenticate(oauth_consumer, self.token)977 yield client.oauth_authenticate(oauth_consumer, self.token)
978 except request.StorageRequestError, e:
979 if client is not self.client:
980 return
981 if e.error_message.error.type == \
982 protocol_pb2.Error.AUTHENTICATION_FAILED:
983 logger.error("OAuth failed: %s", e)
984 self.event_queue.push('SYS_OAUTH_ERROR', error=str(e))
985 else:
986 logger.error("StorageRequestError during OAuth: %s", e)
987 self.event_queue.push('SYS_UNKNOWN_ERROR')
988 self.deferred.callback(Failure(e))
978 except Exception, e:989 except Exception, e:
979 if client is not self.client:990 if client is not self.client:
980 return991 return
981 logger.error("OAuth failed: %s", e.message)992 logger.error("Generic error during OAuth: %s", e)
982 self.event_queue.push('SYS_OAUTH_ERROR', error=e.message)993 self.event_queue.push('SYS_UNKNOWN_ERROR')
983 self.deferred.callback(Failure(e))994 self.deferred.callback(Failure(e))
984 else:995 else:
985 if client is not self.client:996 if client is not self.client:

Subscribers

People subscribed via source and target branches