-
Notifications
You must be signed in to change notification settings - Fork 94
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
[crmsh-4.6] Fix: Don't add time units to values for existing CIB (bsc#1228817) #1506
[crmsh-4.6] Fix: Don't add time units to values for existing CIB (bsc#1228817) #1506
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
d95df04
to
9ff2cfc
Compare
Please refine your pull request description. From it I cannot get why parsing cli parameters affects the behavior of |
Commit 7b2cfb2 automatically appends 's' as the default time unit for timeout and interval. This causes inconsistency in the existing CIB. This commit renames the variable to reflect that it handles both adding advised operation values and time units, but only when the input is from a new CLI command.
9ff2cfc
to
6990656
Compare
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.
This implementation is hard to understand. It depends on if isinstance(cli, str)
at cibconfig.py:865 to call parse(..., auto_add=False)
.
> /usr/lib/python3.11/site-packages/crmsh/cibconfig.py(865)parse_cli_to_xml()
-> node = parse.parse(s, comments=comments)
(Pdb) list
860 default_promotable_meta = False
861 comments = []
862 if isinstance(cli, str):
863 utils.auto_convert_role = False
864 for s in lines2cli(cli):
865 -> node = parse.parse(s, comments=comments)
866 else: # should be a pre-tokenized list
867 utils.auto_convert_role = True
868 if len(cli) >= 3 and cli[0] == "primitive" and cli[2].startswith("@"):
869 auto_add = False
870 default_promotable_meta = False
When calling parse_cli_to_xml
, there are not any explicit parameters to tell the difference between: "Oh, we need to add advised operations and convert 600 to 600s as this is a user input." and "Oh, we should not do these as this is loaded from CIB". What parse_cli_to_xml
will do depends on whether the cli input is tokenized. This too implicit and hard to understand and unmaintainable.
c4f1f1c
to
0c2dde6
Compare
Good point. Thanks! If the customer does have positive feedback, I think we can move on this time |
Problem
Commit 7b2cfb2 automatically appends 's' as the default time unit for timeout and interval. This causes inconsistency in the existing CIB.
How to reproduce
crm configure primitive vip IPaddr2 params ip=10.10.10.123 op monitor interval=10
crm configure show vip
, we can seeinterval=10s
crm configure edit xml vip
, changeinterval=10s
asinterval=10
, then runcrm configure show vip
Root cause
crmsh will compare parsed cib(auto add time unit 's') with original cib(without time unit 's'), if not equal, it will show the XML directly
Fix
This commit renames the variable to reflect that it handles both adding advised operation values and time units, but only when the input is from a new(see above reproduce step 1) CLI command. Don't add time units to values for existing CIB.