-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
util.execute_command() real-time output and ocm.py verbosity level option #926
util.execute_command() real-time output and ocm.py verbosity level option #926
Conversation
Robot Results
|
7914e13
to
ac5cc72
Compare
Just wonder - I can see there are more occurrences of Shouldn't we be consistent and add this verbosity flag also on other occurrences too? I understand that adding this verbose flag doesn't make sense for some commands. But after very quick review e.g.
|
Yes, not sure why it is done so, maybe for situations where a different version of ocm is required. We can fix it in another PR.
Sure, I added it to all relevant ocm commands that either creates, updates, or deletes resources, and skipped it for list/get commands. Help says now: |
32baa89
to
7e338f9
Compare
ocm.py option to set verbosity level to the OCM logging using: --ocm-verbose-level / -v <0-5> The default verbosity level is set to 0. A recommended level is 2. See more info at: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use Signed-off-by: manosnoam <[email protected]>
This is required, since main cli options (-o and -v) cannot be processed after sub commands, as they will be treated as args for the sub commands. It also fixes the `ocm.py --help` that will now display the main commands at the top, before listing the sub commands: ``` optional arguments: -h, --help show this help message and exit -o OCM_CLI_BINARY_URL, --ocmclibinaryurl OCM_CLI_BINARY_URL ocm cli binary url (default: https://github.com/ openshift-online/ocm-cli/releases/download/v0.1.55/ocm-linux-amd64) -v OCM_VERBOSE_LEVEL, --ocm-verbose-level OCM_VERBOSE_LEVEL ocm logging verbosity level (default: 0) Available sub commands: {update_ocm_policy,update_ocm_channel,get_latest_osd_candidate_json, ocm_login,create_cluster,delete_cluster,hibernate_cluster,resume_cluster, delete_idp,get_osd_cluster_info,update_osd_cluster_info,install_rhods_addon, install_gpu_addon,add_machine_pool,uninstall_rhods_addon, install_rhoam_addon,uninstall_rhoam_addon,create_idp} ``` Signed-off-by: manosnoam <[email protected]>
Signed-off-by: manosnoam <[email protected]>
Signed-off-by: manosnoam <[email protected]>
Signed-off-by: manosnoam <[email protected]>
3fd28d4
to
6e1487a
Compare
Signed-off-by: manosnoam <[email protected]>
did you try creating a cluster with the code from this PR? |
Yes I did, see: |
right, sorry I missed that. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Changes looks good to me. We can merge it, if we have tested the workflows. |
This PR includes two improvements for real-time verbosity in:
util.py execute_command()
Every call to
execute_command(<shell command>)
will not wait for the process to end to print the command output, but instead print the output during execution.ocm.py create/update/delete commands
With a new flag option to
ocm.py -v <Number>
(or--ocm_verbose_level
), we can set verbosity level for OCM commands. The default verbosity level is set to 0, the highest is 5.See more info at:
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md#what-method-to-use
These changes are useful to see realtime log output of long running processes (for example when creating a cluster via OCM), as well as any shell command that being executed within ods-ci custom python functions.