def get_queue_items(self):
     """Returns a count of the queued messages the host has sent."""
     proc = start_proc(["/usr/bin/sudo", "rabbitmqctl", "list_queues"], shell=False)
     for line in iter(proc.stdout.readline, ""):
         print("LIST QUEUES:" + line)
         m = re.search("""guest.%s\s+([0-9]+)""" % test_config.values["host_name"], line)
         if m:
             return int(m.group(1))
     return 0
예제 #2
0
 def get_queue_items(self):
     """Returns a count of the queued messages the host has sent."""
     proc = start_proc(["/usr/bin/sudo", "rabbitmqctl", "list_queues"],
                       shell=False)
     for line in iter(proc.stdout.readline, ""):
         print("LIST QUEUES:" + line)
         m = re.search(
             """guest.%s\s+([0-9]+)""" % test_config.values['host_name'],
             line)
         if m:
             return int(m.group(1))
     return 0
 def test_start(self):
     if os.environ.get("INSTALL_GLANCE_IMAGE", "False") == 'True':
         # Check if glance-upload is package installed or not by
         # just checking if the 'known' glance-upload exists
         if os.path.exists("%sglance-upload" % glance_bin_root()):
             exec_str = "%sglance-upload" % glance_bin_root()
         else:
             exec_str = "/usr/bin/glance-upload"
         proc = start_proc([exec_str, "--type=raw",
                            "%s/%s" % (glance_images_directory(),
                                       test_config.glance_image),
                            test_config.glance_image.rstrip(".tar.gz")])
         (stdoutdata, stderrdata) = proc.communicate()
         print "proc.communicate()'s stdout\n%s" % stdoutdata
         print "proc.communicate()'s stderr\n%s" % stderrdata
예제 #4
0
 def test_start(self):
     if os.environ.get("INSTALL_GLANCE_IMAGE", "False") == 'True':
         # Check if glance-upload is package installed or not by
         # just checking if the 'known' glance-upload exists
         if os.path.exists("%sglance-upload" % glance_bin_root()):
             exec_str = "%sglance-upload" % glance_bin_root()
         else:
             exec_str = "/usr/bin/glance-upload"
         proc = start_proc([exec_str, "--type=raw",
                            "%s/%s" % (glance_images_directory(),
                                       test_config.glance_image),
                            test_config.glance_image.rstrip(".tar.gz")])
         (stdoutdata, stderrdata) = proc.communicate()
         print "proc.communicate()'s stdout\n%s" % stdoutdata
         print "proc.communicate()'s stderr\n%s" % stderrdata
예제 #5
0
        def get_queue_items(self, queue_name):
            """Determines if the queue exists and if so the message count.

            If the queue exists the return value is an integer, otherwise
            its None.

            Be careful because queue_name is used in a regex and can't have
            any unescaped characters.

            """
            proc = start_proc(["/usr/bin/sudo", "rabbitmqctl", "list_queues"],
                              shell=False)
            for line in iter(proc.stdout.readline, ""):
                print("LIST QUEUES:" + line)
                m = re.search("""%s\s+([0-9]+)""" % queue_name, line)
                if m:
                    return int(m.group(1))
            return None
예제 #6
0
 def run(self, check_exit_code, *cmd):
     cmds = ["/usr/bin/sudo"] + list(cmd)
     proc = start_proc(cmds)
     lines = proc.stdout.readlines()
     err_lines = proc.stderr.readlines()
     return lines, err_lines