Beispiel #1
0
 def test_instance_generation(self):
     try:
          instancesconf = InstancesConf()
          instancesconf.instances_conf_path = self.filename
          for instance in instancesconf:
              self.assertEquals(instance.name, self.instance_name)
              self.assertEquals(instance.zorp_argv, self.zorp_argv)
              self.assertEquals(instance.number_of_processes, self.zorpctl_argv["num_of_processes"])
              self.assertEquals(instance.auto_restart, self.zorpctl_argv["auto_restart"])
              self.assertEquals(instance.auto_start, self.zorpctl_argv["auto_start"])
              self.assertEquals(instance.enable_core, self.zorpctl_argv["enable_core"])
     except IOError as e:
          self.assertFalse("Something went wrong while initializing InstancesConf object: %s" % e.strerror)
Beispiel #2
0
class RunningInstances(object):
    def __init__(self):
        self.instancesconf = InstancesConf()

    def __iter__(self):
        return self

    def next(self):
        instance = self.instancesconf.next()
        instance.process_num = 0
        algorithm = ProcessAlgorithm()
        algorithm.setInstance(instance)
        if algorithm.isRunning(instance.process_name):
            return instance
        else:
            return self.next()
Beispiel #3
0
 def __init__(self):
     self.instancesconf = InstancesConf()