Bug 1211119

Summary: ability to create lab controllers from CLI
Product: [Retired] Beaker Reporter: matt jia <mjia>
Component: command lineAssignee: matt jia <mjia>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: low    
Version: 19CC: dcallagh, dowang, ebaak, rjoost
Target Milestone: 23.0Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1337812 (view as bug list) Environment:
Last Closed: 2016-07-07 23:10:43 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:
Bug Depends On: 1251355    
Bug Blocks: 1337812    

Description matt jia 2015-04-13 05:00:05 UTC
It would be good to offer people the ability of adding a new lab controller via command line.

Comment 1 Dan Callaghan 2015-04-13 07:17:55 UTC
bkr labcontroller-create --fqdn <fqdn> --username <username> --password <password> --email <address>

--password should be optional in case the site is using Kerberos, other options should be mandatory.

We can add a new Flask handler POST /labcontrollers/ in anticipation of porting that stuff over to Flask/Backbone (it's still TG for now).

Comment 2 Amit Saha 2015-07-06 05:36:13 UTC
(In reply to Dan Callaghan from comment #1)
> bkr labcontroller-create --fqdn <fqdn> --username <username> --password
> <password> --email <address>
> 
> --password should be optional in case the site is using Kerberos, other
> options should be mandatory.
> 
> We can add a new Flask handler POST /labcontrollers/ in anticipation of
> porting that stuff over to Flask/Backbone (it's still TG for now).

Won't labcontroller-add be a better command?

Comment 3 Amit Saha 2015-07-06 07:05:50 UTC
Adds a new subcommand bkr labcontroller-create: http://gerrit.beaker-project.org/#/c/4279/

I have implemented a new API endpoint labcontrollers/new for this so that we can leave the current labcontrollers/ untouched.

Comment 4 Dan Callaghan 2015-07-08 04:21:26 UTC
(In reply to Amit Saha from comment #2)
> Won't labcontroller-add be a better command?

We should stick with labcontroller-create I think. I'd like us to use "create" for creating new records and "add" for adding existing records into collections/relationships (create a pool, vs. add a system to a pool). Even though we're not really consistent with this in old interfaces.

Comment 5 Roman Joost 2015-10-27 04:23:12 UTC
Moving this back to new. Good to have but not really high priority.

Comment 6 Dan Callaghan 2016-04-14 11:21:34 UTC
For playbook idempotency we really want a command which will either create a lab controller with the given FQDN, or update the existing one if it already exists (HTTP PUT semantic, not PATCH).

So maybe bkr labcontroller-modify, with an option --create meaning create it if it doesn't exist? Or maybe the opposite, bkr labcontroller-create --update-existing?

Comment 7 Dan Callaghan 2016-04-14 11:22:12 UTC
Forgot to mention, I want to use this in the Fedora infra playbooks to programmtically define the lab controller. And we have the server side APIs for this now. So I am planning to whip something up.

Comment 8 matt jia 2016-05-19 06:24:03 UTC
(In reply to Dan Callaghan from comment #6)
> For playbook idempotency we really want a command which will either create a
> lab controller with the given FQDN, or update the existing one if it already
> exists (HTTP PUT semantic, not PATCH).
> 
> So maybe bkr labcontroller-modify, with an option --create meaning create it
> if it doesn't exist? Or maybe the opposite, bkr labcontroller-create
> --update-existing?

I would prefer to use bkr labcontroller-modify to update the existing ones. This will match what we have for others, like bkr system-modify, group-modify..

Comment 9 matt jia 2016-05-19 07:00:13 UTC
(In reply to Amit Saha from comment #3)
> Adds a new subcommand bkr labcontroller-create:
> http://gerrit.beaker-project.org/#/c/4279/
> 
> I have implemented a new API endpoint labcontrollers/new for this so that we
> can leave the current labcontrollers/ untouched.

Update this patch with this:

   https://gerrit.beaker-project.org/#/c/4904/

Comment 10 Dan Callaghan 2016-06-13 01:02:33 UTC
This bug fix is included in beaker-client-23.0-0.git.244.0980974 which is currently available for download here:

https://beaker-project.org/nightlies/develop/

Comment 12 Dan Callaghan 2016-07-07 23:10:43 UTC
Beaker 23.0 has been released.