Francesco Romani has posted comments on this change.
Change subject: GuestIF Refactoring ......................................................................
Patch Set 3:
(3 comments)
http://gerrit.ovirt.org/#/c/24618/3/vdsm/guestIF.py File vdsm/guestIF.py:
Line 51: self.log = agent.log Line 52: self._agent = agent Line 53: Line 54: def __call__(self, message, args): Line 55: handler = getattr(self, message.replace('-', '_'), None) maybe this is a good case for (something inspired to) the Null object pattern:
http://en.wikipedia.org/wiki/Null_Object_pattern
probably just a default, one-line, handler which raises UnknownMessageError will be enough. Line 56: if handler: Line 57: handler(args) Line 58: else: Line 59: raise UnknownMessageError(message, args)
Line 70: def os_version(self, args): Line 71: self._agent.guestInfo['guestOs'] = args['version'] Line 72: Line 73: def session_lock(self, args): Line 74: self.agent.guestInfo['session'] = 'Locked' typo? here and below Line 75: Line 76: def session_logoff(self, args): Line 77: self.agent.guestInfo['session'] = 'LoggedOff' Line 78:
Line 76: def session_logoff(self, args): Line 77: self.agent.guestInfo['session'] = 'LoggedOff' Line 78: Line 79: def session_logon(self, args): Line 80: self.agent.guestInfo['session'] = 'UserLoggedOn' all the above are maybe repleacable with some generic dict juggling, but I can't focus on a specific suggestion :( Line 81: Line 82: def session_unlock(self, args): Line 83: self.agent.guestInfo['session'] = 'Active' Line 84: