make lp-affects able to add non-release specific tasks

Bug #1807112 reported by Christian Ehrhardt 
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lptools
New
Undecided
Unassigned

Bug Description

Hi,
currently lp-affects requires all three arguments
  usage: lp-affects-devel [-h] bug package release

But when you add a task on LP quite often you want to just add the package, but not for a given release (e.g. when tracking tasks for the next devel release).

This works fine if we construct the target string slightly different.
We can just make release optional (as in the LP UI) and add it as that if not specified.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The following is all that is needed:
--- /home/paelzer/bin/lp-affects 2018-11-26 15:20:14.606100426 +0100
+++ /home/paelzer/bin/lp-affects-devel 2018-12-06 09:48:11.193017863 +0100
@@ -13,6 +13,8 @@
 parser.add_argument('package',
                     help='src name to add the task')
 parser.add_argument('release',
+ default=None,
+ nargs='?',
                     help='release to mark affected')
 args = parser.parse_args()

@@ -22,6 +24,9 @@
 lp=Launchpad.login_with('affectrelease', 'production', version='devel')

 bug=lp.bugs[args.bug]
-target="/ubuntu/%s/+source/%s" % (args.release, args.package)
+if args.release is None:
+ target="/ubuntu/+source/%s" % (args.package)
+else:
+ target="/ubuntu/%s/+source/%s" % (args.release, args.package)

 bug.addTask(target=target)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.