Skip to content
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

[pacemaker] Replace deprecated "pcs property list" command #3402

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

yinoguchi
Copy link

This patch replaces "pcs property list" with "pcs property config" because "pcs property list" is deprecated and will be removed:

# pcs property list --all 
Deprecation Warning: This command is deprecated and will be removed. Please use 'pcs property config' instead.
Cluster Properties:
...

This warning message was introduced in pcs v0.10.9:
ClusterLabs/pcs@332f56a#diff-4c58cd856f4e8b23a9d99d961c357e224a9f6314542d50add71a04a2b0b6980cR96-R104


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?

Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3402
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Copy link
Contributor

@pmoravec pmoravec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There theoretically might be old versions of pcs deployed (i.e. RHEL8.4 ships 0.10.8 which should have pcs property list only).

@sbradley7777 , do you know if it could be a problem?

@jesusserranost
Copy link

@pmoravec - This will be definitely a problem unless there is some kind of internal check which runs either pcs property list --all or pcs property config --all, depending on the currently installed version of the pcs package. I can confirm there are still clusters deployed with older versions which are still officially supported (as of today), for which this change will break the functionality. I just tested this on a RHEL 8.2 lab and the new command just prints the "Usage help syntax", as expected:

[root@fastvm-rhel-8-2-201 ~]# pcs property config --all | head -5

Usage: pcs property ...
    [list|show [<property> | --all | --defaults]] | [--all | --defaults]
        List property settings (default: lists configured properties).
        If --defaults is specified will show all property defaults, if --all

@pmoravec
Copy link
Contributor

pmoravec commented Nov 3, 2023

There are a few options:

I would personally go for 2nd option: just have a check and use appropriate option per it.

@jesusserranost
Copy link

@pmoravec Second option looks good to me too. Let me know if you want me to test anything or if you need a lab to play with.

@yinoguchi yinoguchi force-pushed the pcs-property-config-all branch from 666f82f to 5268466 Compare November 6, 2023 02:59
@yinoguchi
Copy link
Author

Thank you for the review.
As suggested, I have made modifications to check pcs version and change the command to be executed accordingly.

])

pcs_version = '.'.join(pcs_pkg['version'])
Copy link
Contributor

@pmoravec pmoravec Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try running sos report -o pcaemaker on a system without pcs package installed - you get

TypeError: 'NoneType' object is not subscriptable

here (CI tests fail on this).

One possible solution:

subcmd = 'list'
if pcs_pkg and parse_version('.'.join(pcs_pkg['version'])) > parse_version('0.10.8'):
    subcmd = 'config'
self.add_cmd_output(f"pcs property {subcmd}")

(just wrap up the line with if to 80chars)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again. How about this? I had added a return if the pcs package does not exist. All commands within the setup_pcs() depend on the pcs package, so I believe this should be fine.
Of course, if there are any problems with this, I will make corrections as per your suggestion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry.

flake8 sos
sos/report/plugins/pacemaker.py:48:12: E111 indentation is not a multiple of 4

I will fix this and push it again.

@yinoguchi yinoguchi force-pushed the pcs-property-config-all branch from 5268466 to d5a6df7 Compare November 7, 2023 08:45
Due to the deprecation of the existing "pcs property list",
this patch checks the version of pcs and executes
"pcs property config" as an alternative."

Signed-off-by: Yuki Inoguchi <[email protected]>
@yinoguchi yinoguchi force-pushed the pcs-property-config-all branch from d5a6df7 to 8be0322 Compare November 7, 2023 09:12
Copy link
Contributor

@pmoravec pmoravec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What an elegant solution I have overlooked :)

@TurboTurtle TurboTurtle merged commit 52c9237 into sosreport:main Nov 7, 2023
30 checks passed
@yinoguchi yinoguchi deleted the pcs-property-config-all branch November 10, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants