[RFE]: Enhancements to quads-cli and foreman.py to choose future OS for cloud deployment
In /opt/quads/conf/quads.yml we have a value that defines what OS gets deployed to future systems when they are scheduled:
foreman_default_os: "RHEL 7"
This RFE covers first letting us set another OS other than the default for a future cloud and also listing available options via quads-cli but should also coincide with passing/retaining this request from our internal request process into our scheduling workflow.
Below covers the technical implementation for QUADS.
Proposal and Approach
There are three new argparse cli options to be added, both reliant on functionality added to foreman.py`
Additionally, changes to /opt/quads/quads/tools/move_and_rebuild_hosts.py is required to enforce these if set and the /opt/quads/quads/tools/foreman.py changes to enact them.
Argparse Changes
- An additional argparse parameter to
--define-cloudlikequads-cli --define-cloud cloud02 --os "RHEL 8".
- optional parameter that defaults to whatever to the value of
foreman_default_os - consults Foreman library to query Foreman when input is given, and sanitize/accept input if it matches one of the available operating systems.
- Once a cloud is defined with
--osthis is saved to the cloud object
- An additional argparse argument to
quads-clilike--ls-oswhich calls the Foreman library to return a list of available operating systems (likehammer os list).
- returns the
hammer os listtitle as it appears from Foreman - we don't want to store this in Mongo as it can change in Foreman
- Argparse for
quads-cli --ls-cloud-osto list what OS each cloud is set to, if none is set the default forforeman_default_osis returned which would be stored in MongoDB.
Supporting Provisioning Changes
- Change to
move_and_rebuild_hosts.pyso that if--define-cloudis passed the new option of--os $OS_LIST_CHOICEthen it will perform an additional call toforeman.pyto update all hosts to use that choice instead when mark to build is run.
https://github.com/redhat-performance/quads/blob/master/quads/tools/move_and_rebuild_hosts.py#L177