Bug 1252503

Summary: bkr system-release does not work with beaker-client-20.2-1
Product: [Retired] Beaker Reporter: Miroslav Vadkerti <mvadkert>
Component: command lineAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 20CC: dcallagh, dowang, mjia, optak, rjoost
Target Milestone: 21.0Keywords: Patch, Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-26 06:17:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Miroslav Vadkerti 2015-08-11 14:53:37 UTC
Works with 20.1

Comment 2 Dan Callaghan 2015-08-18 22:15:26 UTC
bkr system-release was changed in 20.2 for bug 1102442. Looking at the patch I see that there is some missing error handling in the new version.

--- a/Client/src/bkr/client/commands/cmd_system_release.py
+++ b/Client/src/bkr/client/commands/cmd_system_release.py
@@ -73,3 +73,4 @@ def run(self, *args, **kwargs):
             update_url = 'systems/%s/reservations/+current' % urllib.quote(fqdn, '')
             requests_session = self.requests_session()
             res = requests_session.patch(update_url, json={'finish': 'now'})
+            res.raise_for_status()

So this probably means that your bkr system-release command was actually being reject but the client wasn't telling you so.

Why it would be rejected, I am not sure exactly. The possibilities are:
* no permission to release the system
* system is running a recipe (cancel the recipe instead)
* some other bug

Comment 7 matt jia 2015-08-19 23:18:23 UTC
(In reply to Miroslav Vadkerti from comment #3)
> So another bug? After adding your patch I see:
> 
> -bash-4.1$ bkr system-release cc-ns4.lab.eng.brq.redhat.com
> HTTP error: 400 Client Error: BAD REQUEST
> Reservation durations are not configurable
> 
> -bash-4.1$ rpm -q beaker-client
> beaker-client-20.2-1.el6eng.noarch

Yes, this is another bug, the quick fix is

--- a/Client/src/bkr/client/commands/cmd_system_release.py
+++ b/Client/src/bkr/client/commands/cmd_system_release.py
@@ -72,4 +72,4 @@ def run(self, *args, **kwargs):
         for fqdn in args:
             update_url = 'systems/%s/reservations/+current' % urllib.quote(fqdn, '')
             requests_session = self.requests_session()
-            res = requests_session.patch(update_url, json={'finish': 'now'})
+            res = requests_session.patch(update_url, json={'finish_time': 'now'})

Comment 8 Dan Callaghan 2015-08-19 23:32:07 UTC
Another workaround is to downgrade to 20.1 version of the client, which doesn't have this problem.

Comment 9 matt jia 2015-08-20 02:14:23 UTC
In bug https://bugzilla.redhat.com/show_bug.cgi?id=1102442, we only have test cases to cover the server side changes which are not efficient. I add some client tests to make sure the bkr system-release command can run successfully.


On Gerrit:

   http://gerrit.beaker-project.org/#/c/4359/

Comment 10 matt jia 2015-08-20 02:15:33 UTC
(In reply to matt jia from comment #9)
> In bug https://bugzilla.redhat.com/show_bug.cgi?id=1102442, we only have
> test cases to cover the server side changes which are not efficient. I add

Sorry, I mean not sufficient.

> some client tests to make sure the bkr system-release command can run
> successfully.
> 
> 
> On Gerrit:
> 
>    http://gerrit.beaker-project.org/#/c/4359/

Comment 11 Dan Callaghan 2015-08-21 02:56:55 UTC
This bug fix is included in beaker-client-21.1-0.git.2.89c3959 which is available for download here:

https://beaker-project.org/nightlies/release-21/

Comment 14 Dan Callaghan 2015-08-26 06:17:44 UTC
Beaker 21.0 has been released.