Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
The version of jenkins-job-builder as available in current jessie is totally broken with regards to its feature to delete Jenkins jobs. There's a fix available from upstream which I included in version 0.9.0-0.2. I've also verified that the fix works as needed. Please unblock package jenkins-job-builder: unblock jenkins-job-builder/0.9.0-0.2 Debdiff of the package versions as in jessie vs. what I just uploaded to Debian/unstable (not yet accepted there though</disclaimer): diff -Nru jenkins-job-builder-0.9.0/debian/changelog jenkins-job-builder-0.9.0/debian/changelog --- jenkins-job-builder-0.9.0/debian/changelog 2014-10-08 08:54:37.000000000 +0200 +++ jenkins-job-builder-0.9.0/debian/changelog 2014-12-22 14:42:20.000000000 +0100 @@ -1,3 +1,10 @@ +jenkins-job-builder (0.9.0-0.2) unstable; urgency=medium + + * Non-maintainer upload. + * Fix deletion of jobs. (Closes: #773642) + + -- Michael Prokop <m...@debian.org> Mon, 22 Dec 2014 13:42:13 +0100 + jenkins-job-builder (0.9.0-0.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru jenkins-job-builder-0.9.0/debian/patches/0006-fix-delete-job-command-and-add-tests.patch jenkins-job-builder-0.9.0/debian/patches/0006-fix-delete-job-command-and-add-tests.patch --- jenkins-job-builder-0.9.0/debian/patches/0006-fix-delete-job-command-and-add-tests.patch 1970-01-01 01:00:00.000000000 +0100 +++ jenkins-job-builder-0.9.0/debian/patches/0006-fix-delete-job-command-and-add-tests.patch 2014-12-22 13:41:19.000000000 +0100 @@ -0,0 +1,80 @@ +From b7ff37ca5dfa1e44447387c636b8b0108404a0bf Mon Sep 17 00:00:00 2001 +From: Khai Do <zaro0...@gmail.com> +Date: Thu, 9 Oct 2014 15:08:18 -0700 +Subject: [PATCH] fix delete job command and add tests + +change I126751e3 introduced recursive file definition feature however it broke +the ability to delete jobs. This changes fixes it and adds a few tests for it. + +This was the error when trying to delete a job: + +(py27)~/jenkins-job-builder$ jenkins-jobs --conf jenkins_jobs.ini delete myjob +INFO:root:Deleting jobs in [myjob] +Traceback (most recent call last): + File "/jenkins-job-builder/.tox/py27/bin/jenkins-jobs", line 10, in <module> + sys.exit(main()) + File "/jenkins-job-builder/jenkins_jobs/cmd.py", line 122, in main + execute(options, config) + File "/jenkins-job-builder/jenkins_jobs/cmd.py", line 207, in execute + builder.delete_job(job, options.path) + File "/jenkins-job-builder/jenkins_jobs/builder.py", line 611, in delete_job + self.load_files(fn) + File "/jenkins-job-builder/jenkins_jobs/builder.py", line 576, in load_files + if os.path.isdir(path): + File "/jenkins-job-builder/.tox/py27/lib/python2.7/genericpath.py", line 41, + in isdir st = os.stat(s) +TypeError: coercing to Unicode: need string or buffer, NoneType found + +Closes-Bug: #1349634 +Change-Id: Ib87fa497d80ba33470c049f875658a3878afb664 +--- + jenkins_jobs/cmd.py | 2 +- + tests/cmd/test_cmd.py | 22 ++++++++++++++++++++++ + 2 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/jenkins_jobs/cmd.py b/jenkins_jobs/cmd.py +index 224ee49..3d9a62a 100755 +--- a/jenkins_jobs/cmd.py ++++ b/jenkins_jobs/cmd.py +@@ -193,7 +193,7 @@ def execute(options, config): + ignore_cache=ignore_cache, + flush_cache=options.flush_cache) + +- if hasattr(options, 'path'): ++ if getattr(options, 'path', None): + if options.path == sys.stdin: + logger.debug("Input file is stdin") + if options.path.isatty(): +diff --git a/tests/cmd/test_cmd.py b/tests/cmd/test_cmd.py +index 792b5f3..61bdc6c 100644 +--- a/tests/cmd/test_cmd.py ++++ b/tests/cmd/test_cmd.py +@@ -208,3 +208,25 @@ class CmdTests(testtools.TestCase): + cmd.execute(args, config) # probably better to fail here + + update_job_mock.assert_called_with(paths, [], output=args.output_dir) ++ ++ @mock.patch('jenkins_jobs.cmd.Builder.delete_job') ++ def test_delete_single_job(self, delete_job_mock): ++ """ ++ Test handling the deletion of a single Jenkins job. ++ """ ++ ++ args = self.parser.parse_args(['delete', 'test_job']) ++ config = configparser.ConfigParser() ++ config.readfp(StringIO(cmd.DEFAULT_CONF)) ++ cmd.execute(args, config) # passes if executed without error ++ ++ @mock.patch('jenkins_jobs.cmd.Builder.delete_job') ++ def test_delete_multiple_jobs(self, delete_job_mock): ++ """ ++ Test handling the deletion of multiple Jenkins jobs. ++ """ ++ ++ args = self.parser.parse_args(['delete', 'test_job1', 'test_job2']) ++ config = configparser.ConfigParser() ++ config.readfp(StringIO(cmd.DEFAULT_CONF)) ++ cmd.execute(args, config) # passes if executed without error +-- +2.1.3 + diff -Nru jenkins-job-builder-0.9.0/debian/patches/series jenkins-job-builder-0.9.0/debian/patches/series --- jenkins-job-builder-0.9.0/debian/patches/series 2014-10-08 00:47:18.000000000 +0200 +++ jenkins-job-builder-0.9.0/debian/patches/series 2014-12-22 13:41:57.000000000 +0100 @@ -3,3 +3,5 @@ # Submitted upstream 0002-general-add-support-for-childCustomWorkspace.patch 0005-builders-add-publish-over-ssh-support-as-a-build-ste.patch +# Retrieved from upstream's git repos +0006-fix-delete-job-command-and-add-tests.patch Thanks for consideration! regards, -mika-
signature.asc
Description: Digital signature