diff --git a/README.rst b/README.rst index 29680f3..85ac700 100644 --- a/README.rst +++ b/README.rst @@ -29,9 +29,18 @@ Installing pre-requisities .. code-block:: bash + ]# yum install -y git python-setuptools autoconf gcc python-devel tar + + Download and install koji from + http://koji.fedoraproject.org/koji/packageinfo?packageID=1181 + ]# git clone https://github.com/gsr-shanks/nexus.git ]# cd nexus - ]# python setup.py + ]# python setup.py install + + ]# python nexus/utils/restraint_repo_finder.py + + ]# yum install -y restraint restraint-client Alternately you can download the rpm version of nexus at https://mrniranjan.fedorapeople.org/ diff --git a/nexus/plugins/restraint.py b/nexus/plugins/restraint.py index 9093765..d728bca 100644 --- a/nexus/plugins/restraint.py +++ b/nexus/plugins/restraint.py @@ -32,25 +32,25 @@ def __init__(self, options, conf_dict): self.existing_nodes = [item.strip() for item in nodes.split(',')] self.jenkins_job_name = conf_dict['jenkins']['job_name'] + self.build_repo_tag = os.environ.get("BUILD_REPO_TAG") def copy_build_repo(self, host, conf_dict): """copy the brew build repo to all the existing nodes""" - build_repo_tag = os.environ.get("BUILD_REPO_TAG") - build_repo_file = build_repo_tag + ".repo" - build_repo_url = os.environ.get("BUILD_REPO_URL") + self.build_repo_file = self.build_repo_tag + ".repo" + self.build_repo_url = os.environ.get("BUILD_REPO_URL") - logger.log.info("Creating build repo file %s" % build_repo_file) - repo = open(build_repo_file, "w") - repo.write( "[" + build_repo_tag + "]\n"); - repo.write( "name=" + build_repo_tag + "\n" ); - repo.write( "baseurl=" + build_repo_url + "\n" ); + logger.log.info("Creating build repo file %s" % self.build_repo_file) + repo = open(self.build_repo_file, "w") + repo.write( "[" + self.build_repo_tag + "]\n"); + repo.write( "name=" + self.build_repo_tag + "\n" ); + repo.write( "baseurl=" + self.build_repo_url + "\n" ); repo.write( "enabled=1\n") ; repo.write( "gpgcheck=0\n" ); repo.write( "skip_if_unavailable=1\n" ); repo.close() - source = build_repo_file + source = self.build_repo_file destination = "/etc/yum.repos.d/" + source logger.log.info("source file is %s" % source) @@ -139,6 +139,7 @@ def restraint_update_xml(self): node = node + 1 host_num = host_num + 1 else: + logger.log.error("%s not found" % self.restraint_xml) sys.exit(2) def execute_restraint(self): @@ -213,15 +214,23 @@ def run_restraint(self, options, conf_dict): host, conf_dict) for host in \ self.existing_nodes]) - if options.build_repo is None: + if self.build_repo_tag: + logger.log.info("BUILD_REPO_TAG found in env") + logger.log.info("Copying %s to %s" % (self.copy_build_repo, host)) 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]) + else: + logger.log.info("No manual repo to be copied to resources.") logger.log.info("Using %s" % self.restraint_xml) if len(self.existing_nodes) == 1: diff --git a/nexus/tasks/cli.py b/nexus/tasks/cli.py index 5c2cf94..c319d28 100644 --- a/nexus/tasks/cli.py +++ b/nexus/tasks/cli.py @@ -54,7 +54,8 @@ def create_parser(): parser_errata.add_argument('--show-triggers', help=argparse.SUPPRESS) parser_restraint = subparser.add_parser('restraint') - parser_restraint.add_argument('--build-repo', help='Build repo') + parser_restraint.add_argument('--build-repo', help='.repo file which you \ + would like to copy to test resources') parser_restraint.add_argument('--restraint-xml', help='Restraint xml file') parser_restraint.add_argument('--show-triggers', help=argparse.SUPPRESS) diff --git a/setup.py b/setup.py index d7b1531..564e869 100644 --- a/setup.py +++ b/setup.py @@ -17,13 +17,16 @@ def readme(): packages=find_packages(), scripts=['bin/nexus'], install_requires=[ - 'paramiko', - 'ConfigParser', - 'simplejson', + 'pbr', 'wget', 'glob2', - 'python-jenkins', - 'pbr' + 'paramiko', + 'argparse', + 'requests', + 'simplejson', + 'ConfigParser', + 'BeautifulSoup', + 'python-jenkins' ], include_package_data=True )