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

landscape-client: handle already registered client #4784

Merged
merged 7 commits into from
May 3, 2024

Conversation

chifac08
Copy link
Contributor

@chifac08 chifac08 commented Jan 17, 2024

landscape-client: handle already registered client

This PR makes use of "is-registered" parameter to prevent duplicate entries 
of clients on a Landscape server when cloud-init runs more than once.

Additional Context

The parameter was introduced to landscape-client in version 23.02 (canonical/landscape-client#103) and has been available in "release (main)" repository since Lunar. The package is currently in "proposed" repository for Focal as well as Jammy and will hopefully be released in near future. So please keep in mind, if this PR should make it's way in the upstream we have to take care about the current release status of all supported Ubuntu releases. Please have a look at launchpad

Test Steps

Checklist

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Thank you @chifac08 for continued support and contributions to cloud-init.
I do think we probably want to pull the landscape-config --is-registered check up before we invoke the full landscape-config --silent command with all the cmd_params. Otherwise, I'm not quite certain how landscape-config is expected to behave when not registered, but when it's also provided with all necessary config options to register.

I think we'll also want to check with @Perfect5th on the estimated SRU verification for the currently queued SRU back to Jammy for landscape-client v. 23 before we land this as we'd have to back out those changes on stable releases for cloud-init which also targets back to Jammy.

cloudinit/config/cc_landscape.py Outdated Show resolved Hide resolved
@blackboxsw blackboxsw self-assigned this Jan 18, 2024
@chifac08
Copy link
Contributor Author

Implemented changes you requested. Furthermore, I added some unit tests. Please review again. thx

Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Thanks @chifac08 for the update and unit tests. In testing on a live system we can see that the rcs=[5] handling isn't working as your code expects. I've proposed an alternative that you may want to take a peek at.

Also I know the landscape-client is proposed for update into Focal and Jammy so that landscape-config --is-registered should be available on all supported Ubuntu releases that cloud-init updates.

But, we will need to wait on releasing this in cloud-init until landscape-client 23.02 published to focal. The current status of landscape-client SRU is present in blocked state here https://ubuntu-archive-team.ubuntu.com/pending-sru.html. rmadison landscape-client can also tell us once that SRU publication is officially accepted.

try:
subp.subp(["landscape-config", "--silent", "--is-registered"], rcs=[5])
subp.subp(["landscape-config", "--silent"] + cmd_params)
util.write_file(LS_DEFAULT_FILE, "RUN=1\n")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I actually think writing this file a feature that is now obsolete and unnecessary given that we are running landscape-config directly which will start the landscape-client services up and ensure they are active at boot. It was first introduced in 2012 when this module was writing directly to /etc/landscape/client.conf and performing a service landscape-client restart after writing configs. I don't think the recent landscape-client on any supported Ubuntu series from Focal onward consumes this RUN=1 setting in /etc/default/landscape-client anymore. So, let's drop the LS_DEFAULT_FILE variable and this write_file as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just validated that all services are appropriately started on Ubuntu focal with landscape-client 18.01-0ubuntu4.3 and no RUN=1 needed in /etc/default/landscape-client. Yes this can be dropped/

Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Approve the changeset, but I'd prefer to avoid landing this until https://bugs.launchpad.net/landscape-client/+bug/2006402 lands and SRUs to Focal so we don't have to stub out the --is-registered parameter logic.

tests/unittests/config/test_cc_landscape.py Outdated Show resolved Hide resolved
tests/unittests/config/test_cc_landscape.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Feb 24, 2024
@canonical canonical deleted a comment from github-actions bot Feb 28, 2024
@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Feb 28, 2024
@blackboxsw
Copy link
Collaborator

Still waiting on SRU resolution for landscape-client before this lands.

Copy link

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.)

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Mar 14, 2024
@TheRealFalcon TheRealFalcon removed the stale-pr Pull request is stale; will be auto-closed soon label Mar 14, 2024
@TheRealFalcon
Copy link
Member

@blackboxsw , looks like the last comment on that bug is from 2023-10-20 . Do we expect that to be SRUed anytime soon?

@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Mar 29, 2024
@canonical canonical deleted a comment from github-actions bot Apr 2, 2024
@blackboxsw
Copy link
Collaborator

@blackboxsw , looks like the last comment on that bug is from 2023-10-20 . Do we expect that to be SRUed anytime soon?

Yep. I had circled back with the team and was assured they had it on their planning and it looks like verification just got unblocked yesterday. We expect this release within a week now that verification is complete for Focal/Jammy. https://bugs.launchpad.net/landscape-client/+bug/2006402/comments/53

@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Apr 4, 2024
@github-actions github-actions bot added the stale-pr Pull request is stale; will be auto-closed soon label Apr 19, 2024
@blackboxsw blackboxsw removed the stale-pr Pull request is stale; will be auto-closed soon label Apr 23, 2024
@blackboxsw
Copy link
Collaborator

Checked again on this landscape-client SRU. All tests are verified, SRU review queue is saturated given demand for Noble release reviews. Giving this another week to allow the Noble release week testing to pass this week which should free up SRU vanguards to unblock landscape-client publication.

@canonical canonical deleted a comment from github-actions bot Apr 23, 2024
@blackboxsw
Copy link
Collaborator

chifac08 looks like landscape-client published yesterday. I just validated your PR works great on both Ubuntu focal and jammy with the newly published landscape-client --is-registered param. Finally landing this without further delay.

@blackboxsw blackboxsw merged commit aa357fa into canonical:main May 3, 2024
29 checks passed
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.

3 participants