Beispiel #1
0
    def run_repo_setup(self, options, conf_dict):
        """
        run async_updates repo function using threads per host.
        """

        threads = Threader()

        if self.build_repo_tag:
            logger.log.info("BUILD_REPO_TAG found in env")
            threads.gather_results([threads.get_item(self.copy_build_repo, \
                                    host, conf_dict) for host in \
                                    self.existing_nodes])
        else:
            logger.log.info("BUILD_REPO_TAG not found in env")

        if options.build_repo:
            logger.log.info("Manual repo to be copied to resources.")
            self.build_repo = options.build_repo
            threads.gather_results([threads.get_item(self.my_build_repo, \
                                   host, conf_dict) for host in \
                                   self.existing_nodes])

        if "z-candidate" in self.brew_tag:
            logger.log.info(
                "brew tag is for z-candidate, hence picking batched repo from conf."
            )
            threads.gather_results([threads.get_item(self.copy_async_updates_repo, \
                                    host, conf_dict) for host in \
                                    self.existing_nodes])
        else:
            logger.log.info(
                "brew tag is not for z-candidate, hence not picking any batched repo from conf."
            )
Beispiel #2
0
    def run_restraint(self, options, conf_dict):
        """
        Call restraint_setup function using threads per host.
        """

        logger.log.info("Running restraint...")
        threads = Threader()

        self.job_name = conf_dict['jenkins']['job_name']
        self.git_repo_url = conf_dict['git']['git_repo_url']
        self.git_test_branch = conf_dict['git']['git_test_branch']

        if options.restraint_xml is None:
            self.jenkins_workspace = conf_dict['jenkins']['workspace']
            try:
                self.restraint_xml_loc = conf_dict['restraint_jobs'][self.jenkins_job_name]
                self.restraint_xml = os.path.join(self.jenkins_workspace, \
                                     self.restraint_xml_loc)
            except KeyError:
                logger.log.warn("restraint xml not found in conf file, check with WHAT_TEST")
                self.what_test = os.environ.get("WHAT_TEST") + ".xml"
                self.restraint_job_xml_loc = conf_dict['restraint']['job_xml_loc']
                self.restraint_xml = os.path.join(self.restraint_job_xml_loc, self.what_test)

            threads.gather_results([threads.get_item(self.restraint_setup, \
                                    host, conf_dict) for host in \
                                    self.existing_nodes])
        else:
            self.restraint_xml = options.restraint_xml
            threads = Threader()
            threads.gather_results([threads.get_item(self.restraint_setup, \
                                    host, conf_dict) for host in \
                                    self.existing_nodes])

        logger.log.info("Using %s" % self.restraint_xml)

        if len(self.existing_nodes) == 1:
            logger.log.info("Found single host in existing_nodes")
            logger.log.info("single node: %s" % self.existing_nodes)
            self.restraint_update_xml()
            self.execute_restraint()
        else:
            logger.log.info("Found multiple hosts in existing_nodes")
            logger.log.info("multiple nodes: %s" % self.existing_nodes)
            self.restraint_update_xml()
            self.execute_restraint()