cloud-init
cloud-init copied to clipboard
cloud.cfg.tmpl: make sure "centos" settings are identical to "rhel"
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
- Boot the latest CentOS Stream cloud image
- Attempt to log in with the "cloud-user"
- 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
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
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
That's not enough. That's only the cloud-init-generator systemd service.
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 @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 :)
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 see if it's better now
Any updates here? Do we have a path forward?
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