Change in vdsm[master]: GuestIF Refactoring

fromani at redhat.com fromani at redhat.com
Tue Feb 18 13:29:42 UTC 2014


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: 


-- 
To view, visit http://gerrit.ovirt.org/24618
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib357d770a26ef1dc80b89a32bf6808551a7d622d
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list