Comment 1 for bug 553547

Revision history for this message
John O'Brien (jdobrien) wrote : Re: [Bug 553547] [NEW] Attribute error when recieving ShareChanged message

On 04/01/2010 04:09 PM, John O'Brien wrote:
> Public bug reported:
>
> I deleted a share on the web, and got the following a few seconds later
> in the client:
>
> 2010-04-01 16:05:26,829 - ubuntuone.SyncDaemon.EQ - DEBUG - push_event: SV_SHARE_CHANGED, args:(), kw:{'info': UUID('eb16a306-6875-460b-ad07-8f43ea9fbc47'), 'message': 'deleted'}
> 2010-04-01 16:05:26,829 - ubuntuone.SyncDaemon.EQ - ERROR - Error encountered while handling: SV_SHARE_CHANGED in<ubuntuone.syncdaemon.volume_manager.VolumeManager object at 0x33931d0>
> Traceback (most recent call last):
> File "/usr/lib/python2.6/dist-packages/ubuntuone/syncdaemon/event_queue.py", line 790, in _dispatch
> method(*args, **kwargs)
> File "/usr/lib/python2.6/dist-packages/ubuntuone/syncdaemon/volume_manager.py", line 541, in handle_SV_SHARE_CHANGED
> self.log.debug('share deleted! %s', info.share_id)
> AttributeError: 'UUID' object has no attribute 'share_id
>
> ** Affects: ubuntuone-client
> Importance: Undecided
> Status: New
>
>
The error is caused because the client handler does not match what the
protocol sends to it. And the tests conform to what the client expects
and not what the protocol sends:

The protocol:

         if msg.type == protocol_pb2.Message.NOTIFY_SHARE:
             info =
sharersp.NotifyShareHolder.load_from_msg(msg.notify_share)
             self._share_change_callback("changed", info)
         elif msg.type == protocol_pb2.Message.SHARE_DELETED:
             self._share_change_callback("deleted",

uuid.UUID(msg.share_deleted.share_id))

The client:
     def handle_SV_SHARE_CHANGED(self, message, info):
         """ handle SV_SHARE_CHANGED event """
         if message == 'changed':
             if str(info.share_id) not in self.shares:
                 self.log.debug("New share notification, share_id: %s",
                          info.share_id)
                 dir_name = self._build_share_path(info.share_name,
                                                   info.from_visible_name)
                 path = os.path.join(self.m.shares_dir, dir_name)
                 share = Share.from_notify_holder(info, path)
                 self.add_share(share)
             else:
                 self.log.debug('share changed! %s', info.share_id)
                 self.share_changed(info)
         elif message == 'deleted':
             self.log.debug('share deleted! %s', info.share_id)
             self.share_deleted(str(info.share_id))