Description of problem: Updating retention tag using 'bkr job-modify' command behaves inconsistently. It's not possible to reliably set retention to one of those which do not require product to be associated. It can be workarounded once using --product '' but succesive command fails. Version-Release number of selected component (if applicable): beaker-client-0.9.4-2.el6eng.noarch Steps to Reproduce: $ bkr job-modify J:334956 --retention-tag scratch Successfully modified jobs J:334956 $ bkr job-modify J:334956 --retention-tag 120days Successfully modified jobs J:334956 $ bkr job-modify J:334956 --retention-tag audit --product cpe:/o:redhat:enterprise_linux:6:update3 Successfully modified jobs J:334956 $ bkr job-modify J:334956 --retention-tag 120days <Fault 1: "<class 'bkr.common.bexceptions.BeakerException'>:'Job 334956 not updated: Incompatible product and tags'"> No jobs modified $ bkr job-modify J:334956 --retention-tag 120days --product '' Successfully modified jobs J:334956 $ bkr job-modify J:334956 --retention-tag 120days --product '' <Fault 1: "<type 'exceptions.AttributeError'>:'int' object has no attribute '_sa_instance_state'">
Expected results: When one of 'scratch', '60days', '120days' tags provided, product is cleared automatically, no option --product is required.
(In reply to comment #1) > Expected results: > > When one of 'scratch', '60days', '120days' tags provided, product > is cleared automatically, no option --product is required. We were trying to keep it consistent with how it works via the UI. Via the UI, you need to confirm that you will be removing the product when you go to 'scratch', '60days' etc, and explicitly setting the product to '' in beaker-client is more or less equivalent.
I see. But what would you suggest to do when I want to script setting the retention to 120days without knowing the current status? For now the only way I can think of is: current = fetch_the_current_retention_from_beaker if current in ['audit', 'active', 'active+']: bkr job-modify J:334956 --retention-tag 120days --product '' else: bkr job-modify J:334956 --retention-tag 120days Which seems to me like quite cumbersone and ineffective way.
The bug is this one: > $ bkr job-modify J:334956 --retention-tag 120days --product '' > <Fault 1: "<type 'exceptions.AttributeError'>:'int' object has no attribute > '_sa_instance_state'"> You should be able to just unconditionally use --retention-tag 120days --product ''.
Yes, that would solved the problem. Do you expect this to be fixed soon? I believe the implementation should not be complicated. Thanks.
When trying modify recipeset with -t and -p options, it will show error message and successful message. Make it confused. Actual: [root@dhcp-65-142 ~]# bkr job-modify -r nak RS:119 -t active+1 -p cpe:/o:redhat:rhel_mission_critical:5.6 <Fault 1: <type 'exceptions.AttributeError'>:'RecipeSet' object has no attribute 'can_change_product'> Successfully modified jobs RS:119 Expected: Can't change tag or product for RecipeSet.
This is a different and separate issue. The original issue is about inconsistent behaviour when setting certain combinations of product and retention tags.
(In reply to Raymond Mancy from comment #8) Okay, open a bug for comment #7 : https://bugzilla.redhat.com/show_bug.cgi?id=1039807
I fixed this bug while working on bug 1022333. http://gerrit.beaker-project.org/2623
verified on beaker-devel(beaker-0.15.3-0.git.5.46f86da)-->pass Steps: [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag scratch Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag audit --product cpe:/o:redhat:enterprise_linux:6:update3 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days <Fault 1: "<class 'bkr.common.bexceptions.BeakerException'>:Job 2546 not updated: Incompatible product and tags"> No jobs modified [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag scratch Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag audit <Fault 1: "<class 'bkr.common.bexceptions.BeakerException'>:Job 2546 not updated: Incompatible product and tags"> No jobs modified [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag audit --product cpe:/o:redhat:enterprise_linux:6:update3 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active --product cpe:/a:redhat:rosp:1.0 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active --product cpe:/a:redhat:rosp:1.0 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days <Fault 1: "<class 'bkr.common.bexceptions.BeakerException'>:Job 2546 not updated: Incompatible product and tags"> No jobs modified [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active <Fault 1: "<class 'bkr.common.bexceptions.BeakerException'>:Job 2546 not updated: Incompatible product and tags"> No jobs modified [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active --product cpe:/a:redhat:rosp:1.0 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag active --product cpe:/a:redhat:rosp:1.0 Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag scratch Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag scratch --product '' Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag 120days Successfully modified jobs J:2546 [root@dhcp-10-121 beakernew]# bkr job-modify J:2546 --retention-tag scratch Successfully modified jobs J:2546 Actual results: same as expected results Expected results: Successfully modified jobs in steps above.
This change is included in the Beaker 0.15.3 maintenance release: http://beaker-project.org/docs/whats-new/release-0.15.html#beaker-0-15-3