def __init__(self, name, config, msg, hosts, server, swversion, osversion, dependency, optional, depsinglehost, checkparams, gid=None, dynamic=False): """Initialises MsgTask object""" WTask.__init__(self, name, config) self.msg = msg self.hosts = hosts self.servertype = server self.dependency = dependency self.checkparams = checkparams self.optional = optional self.depsinglehost = depsinglehost self.swversion = swversion self.osversion = osversion self.dynamic = dynamic self.gid = gid
def equals(self, task): """ Compares this Task with that described by task, and returns if they are the same. It ignores the hosts parameter as when this is part of a StatusTask the hosts is irrelevant, as it will have been expanded to a Host object Arguments: task: Task to compare against Returns: True: if same False: if different """ if not WTask.equals(self, task): return False if not isinstance(task, MsgTask): log.debug("Task is not a MsgTask %s" % task.name) return False if self.msg != task.msg: log.debug("Msg differ %s/%s for %s" % (self.msg, task.msg, self.name)) return False if self.servertype != task.servertype: log.debug("Server type differs %s/%s" % (self.servertype, task.servertype)) return False if self.dependency != task.dependency: log.debug("Dependency differs %s/%s" % (self.dependency, task.dependency)) return False if self.checkparams != task.checkparams: log.debug("Checkparams differ %s/%s for %s" % (self.checkparams, task.checkparams, self.name)) return False if self.gid != task.gid: log.debug("Group id differ {0}/{1} for {2}".format( self.gid, task.gid, self.name)) return False if self.swversion != task.swversion: log.debug("Version differ %s/%s for %s" % (self.swversion, task.swversion, self.name)) return False if self.osversion != task.osversion: log.debug("Version differ %s/%s for %s" % (self.osversion, task.osversion, self.name)) return False if self.dynamic != task.dynamic: log.debug("Dynamic differ %s/%s for %s" % (self.dynamic, task.dynamic, self.name)) return False return True