From 69a88f87dc70f71f2455f2a52a40a338a85b004d Mon Sep 17 00:00:00 2001 From: Gowrishankar Rajaiyan Date: Fri, 27 Feb 2015 00:33:22 +0530 Subject: [PATCH 1/4] Earlier it was mandatory to provider --build-repo option to restraint subcommand as an option. With this patch it has become optional as the script will move ahead since there are no repos to be copied. --- nexus/plugins/restraint.py | 29 +++++++++++++++++++---------- nexus/tasks/cli.py | 3 ++- 2 files changed, 21 insertions(+), 11 deletions(-) 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) From b6ae3fc7c4fc37a54b1a58f427249cf5457fc772 Mon Sep 17 00:00:00 2001 From: Gowrishankar Rajaiyan Date: Fri, 27 Feb 2015 01:29:43 +0530 Subject: [PATCH 2/4] update readme and setup.py --- README.rst | 11 ++++++++++- setup.py | 13 ++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 29680f3..b88780d 100644 --- a/README.rst +++ b/README.rst @@ -29,9 +29,18 @@ Installing pre-requisities .. code-block:: bash + ]# yum install -y python-setuptools autoconf gcc python-devel + + 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/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 ) From 091649aa40fb57ce56c43cd663d57a591a9d9f4d Mon Sep 17 00:00:00 2001 From: Gowrishankar Rajaiyan Date: Fri, 27 Feb 2015 01:56:49 +0530 Subject: [PATCH 3/4] include tar to yum install list --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b88780d..e7ffbad 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ Installing pre-requisities .. code-block:: bash - ]# yum install -y python-setuptools autoconf gcc python-devel + ]# yum install -y python-setuptools autoconf gcc python-devel tar Download and install koji from http://koji.fedoraproject.org/koji/packageinfo?packageID=1181 From fc75abd5d9c57979de0aa23ab4ee485a52539454 Mon Sep 17 00:00:00 2001 From: Gowrishankar Rajaiyan Date: Fri, 27 Feb 2015 02:03:01 +0530 Subject: [PATCH 4/4] add git to yum install list --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index e7ffbad..85ac700 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ Installing pre-requisities .. code-block:: bash - ]# yum install -y python-setuptools autoconf gcc python-devel tar + ]# yum install -y git python-setuptools autoconf gcc python-devel tar Download and install koji from http://koji.fedoraproject.org/koji/packageinfo?packageID=1181