-
Notifications
You must be signed in to change notification settings - Fork 75
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
disable: cli disable progress refactor #3028
Conversation
Jira: This PR is not related to a Jira item. (The PR title does not include a SC-#### reference) GitHub Issues: No GitHub issues are fixed by this PR. (No commits have Fixes: #### references) Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references) Documentation: The changes in this PR do not require documentation changes. 👍 this comment to confirm that this is correct. |
🌎 This PR changes translatable messages. 🌏 Please select which scenarios apply. For further explanation, please read our policy on message changes.
|
50aa367
to
5f02aff
Compare
5f02aff
to
20c41bf
Compare
|
||
def get_title(cfg: UAConfig, ent_name: str, variant=""): | ||
try: | ||
return entitlement_factory(cfg, ent_name, variant=variant)( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check, what is the advantage of this approach ? We are now creating the entitlement object to fetch the title, which is not necessary.
Is that because of we might miss a variant title by using ENTITLEMENT_NAME_TO_TITLE
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unfortunately necessary for cis, because the title depends on self.called_name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cry so much everytime this kind of comment pops out somewhere
We need to kill this horrible bug
@@ -216,7 +186,9 @@ def action_enable(args, *, cfg, **kwargs) -> int: | |||
if json_output: | |||
progress = api.ProgressWrapper() | |||
else: | |||
progress = api.ProgressWrapper(CLIEnableProgress()) | |||
progress = api.ProgressWrapper( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this is not a problem introduced in this PR, but I noticed that we are now creating the same entitlement
object on lines 155 and 193. I think we should only do that once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep I can consolidate them
uaclient/cli/cli_util.py
Outdated
def _on_event(self, event: str, payload): | ||
if event == "info": | ||
print(payload) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit, but I think we can remove the empty return here
20c41bf
to
1ec0a28
Compare
@lucasmoura updated! |
the title depends on the called_name and variant, so getting it from the class is not sufficient.
afb4727
to
de1856d
Compare
Why is this needed?
This refactors the disable cli command to use the progress api for printing messages to the user, which will allow the api for disable to be implemented without hacking around prompts deep in the call stack.
Test Steps
CI and tests should all pass
Checklist
Does this PR require extra reviews?