cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

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

Open esposem opened this issue 3 years ago • 6 comments
trafficstars

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 <[email protected]>

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:

  • [x] 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

esposem avatar Aug 08 '22 07:08 esposem

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

Conan-Kudo avatar Aug 08 '22 08:08 Conan-Kudo

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

esposem avatar Aug 08 '22 11:08 esposem

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

Conan-Kudo avatar Aug 09 '22 02:08 Conan-Kudo

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.

LaneWolf avatar Aug 09 '22 10:08 LaneWolf

@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 :)

holmanb avatar Aug 10 '22 18:08 holmanb

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.

Conan-Kudo avatar Aug 11 '22 07:08 Conan-Kudo

@Conan-Kudo see if it's better now

esposem avatar Aug 16 '22 11:08 esposem

Any updates here? Do we have a path forward?

TheRealFalcon avatar Aug 24 '22 18:08 TheRealFalcon

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

esposem avatar Aug 24 '22 18:08 esposem