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

cloud.cfg.tmpl: make sure "centos" settings are identical to "rhel" #1639

Merged
merged 1 commit into from Sep 7, 2022

Conversation

esposem
Copy link
Contributor

@esposem esposem commented Aug 8, 2022

Proposed Commit Message

We have a couple of bugs where centos does not have the default user as rhel.
This PR makes sure the configuration is exactly the same.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

RHBZ: 2115565 and 2115576

Test Steps

  1. Boot the latest CentOS Stream cloud image
  2. Attempt to log in with the "cloud-user"
  3. Attempt to log in with the "centos" user

Actual results:
Login fails with "cloud-user" and succeeds with "centos"

Expected results:
Login succeeds with "cloud-user" and fails with "centos"

Additional info:
Originally, RHEL/CentOS used "cloud-user" with the custom cloud-init configuration files. Too much configuration was removed in the rebase to cloud-init v22.1.

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

@Conan-Kudo
Copy link
Contributor

Not that this wouldn't help fix the problem for CentOS, but I think the problem is that we're not making the right calls in our spec file in RHEL/CentOS to ensure that the correct configuration is generated?

The Fedora spec ensure the RHEL variant is used for RHEL-like systems, while it ensures the Fedora variant is used for Fedora-like ones.

%py3_install -- --init-system=systemd 

# Generate cloud-config file 
python3 tools/render-cloudcfg --variant %{?rhel:rhel}%{!?rhel:fedora} > $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg

@esposem
Copy link
Contributor Author

esposem commented Aug 8, 2022

As already explained in the BZ comment, the right call is performed in our spec file:

python3 tools/render-cloudcfg --variant rhel systemd/cloud-init-generator.tmpl > $RPM_BUILD_ROOT%{_systemdgeneratordir}/cloud-init-generator

@Conan-Kudo
Copy link
Contributor

Conan-Kudo commented Aug 9, 2022

That's not enough. That's only the cloud-init-generator systemd service.

@LaneWolf
Copy link

LaneWolf commented Aug 9, 2022

This is not problem of calling but problem of template. Template create cloud-user only for rhel not for centos. Template has to be fixed here.

@holmanb holmanb self-assigned this Aug 10, 2022
@holmanb
Copy link
Member

holmanb commented Aug 10, 2022

@LaneWolf @Conan-Kudo @esposem - Thanks for the discussion, and @esposem for a proposed fix.

I'm looking forward to merging a fix, but I'd prefer to see consensus if possible before putting in time on a review. Give a ping if that doesn't seem likely and we'll figure it out one way or another.

In the meantime thanks all for your efforts :)

@Conan-Kudo
Copy link
Contributor

The issue with doing it this way is that it means every RHEL derivative needs to be filled in here too. That's why I deliberately have the cloud-init spec file in Fedora calling either the Fedora or RHEL variant for generating the templates. It gets way too complicated and ugly otherwise.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
@esposem
Copy link
Contributor Author

esposem commented Aug 16, 2022

@Conan-Kudo see if it's better now

config/cloud.cfg.tmpl Show resolved Hide resolved
@TheRealFalcon
Copy link
Member

Any updates here? Do we have a path forward?

@esposem
Copy link
Contributor Author

esposem commented Aug 24, 2022

From what I understand, we (redhat, me and @LaneWolf) agree on keeping it as it is. So from our side, this PR can go ahead

Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

I don't see any more activity on this PR, so I'm going to wrap this up.

Since this forces alignment between CentOS and RHEL and doesn't otherwise break or change other distro definitions, I'm going to merge.

We can modify other distros if required in subsequent PRs.

Thanks again @Conan-Kudo, @esposem, and @LaneWolf :)

@holmanb holmanb merged commit 7593243 into canonical:main Sep 7, 2022
12 checks passed
markgoddard added a commit to stackhpc/stackhpc-kayobe-config that referenced this pull request Nov 15, 2022
cloud-init was changed to make CentOS more similar to RHEL, using a
cloud-user account rather than centos.

canonical/cloud-init#1639
nazunalika added a commit to nazunalika/cloud-init that referenced this pull request Jan 10, 2023
The previous change in PR canonical#1887 attempted to fix some issues created by
PR's canonical#1431 and canonical#1639. Unfortunately this change wrongly assumed all
derivatives were not expecting cloud-user. This attempts to correct that.
nazunalika added a commit to nazunalika/cloud-init that referenced this pull request Jan 10, 2023
The previous change in PR canonical#1887 attempted to fix some issues created by
PR's canonical#1431 and canonical#1639. Unfortunately this change wrongly assumed all
derivatives were not expecting cloud-user. This attempts to correct
that.
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.

None yet

5 participants