Files
cloud-init/cloud-init-ssh-usrmerge.patch
Robert Schweikert 45e0874bb7 - Update to version 25.1.1 (bsc#1239715,jsc#PED-8680,bsc#1228414)
+ Removed included upstream
   - pep-594-drop-pipes.patch
   - cloud-init-fix-python313.patch
   - cloud-init-dont-assume-ordering-of-ThreadPoolExecutor.patch
   - cloud-init-direxist.patch
   - cloud-init-wait-for-net.patch
   - cloud-init-usr-sudoers.patch
   - cloud-init-no-nmcfg-needed.patch
   - cloud-init-keep-flake.patch
   - cloud-init-lint-fixes.patch
   - cloud-init-pckg-reboot.patch
   - cloud-init-ds-deterministic.patch
   - cloud-init-write-routes.patch
   - cloud-init-skip-empty-conf.patch
 + Forward port
   - cloud-init-no-tempnet-oci.patch
   - cloud-init-no-openstack-guess.patch
   - cloud-init-lint-set-interpreter.patch
 + Add
   - cloud-init-ssh-usrmerge.patch (bsc#1237764)
   - cloud-init-lint-set-interpreter.patch
   - cloud-init-lint-fix.patch
   - cloud-init-no-single-process.patch
   - cloud-init-needs-action.patch
 + Drop hidesensitivedata in 16 & greater
 + test: pytestify cc_chef tests, add migration test
 + chef: migrate files in old config directories for backups and cache
 + fix: correct the path for Chef's backups (#5994)
 + fix(Azure): don't reraise FileNotFoundError during ephemeral setup (#6113)

OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/cloud-init?expand=0&rev=245
2025-05-15 18:10:38 +00:00

35 lines
1.5 KiB
Diff

--- cloudinit/ssh_util.py.orig
+++ cloudinit/ssh_util.py
@@ -544,6 +544,10 @@ def parse_ssh_config_map(fname):
def _includes_dconf(fname: str) -> bool:
+ # Handle cases where sshd_config is handled in /usr/etc/ssh/sshd_config
+ # so /etc/ssh/sshd_config.d/ exists but /etc/ssh/sshd_config doesn't
+ if not os.path.exists(fname) and os.path.exists(f"{fname}.d"):
+ return True
if not os.path.isfile(fname):
return False
for line in util.load_text_file(fname).splitlines():
--- tests/unittests/test_ssh_util.py.orig
+++ tests/unittests/test_ssh_util.py
@@ -561,6 +561,18 @@ class TestUpdateSshConfig:
expected_conf_file = f"{mycfg}.d/50-cloud-init.conf"
assert not os.path.isfile(expected_conf_file)
+ def test_without_sshd_config(self, tmpdir):
+ """In some cases /etc/ssh/sshd_config.d exists but /etc/ssh/sshd_config
+ doesn't. In this case we shouldn't create /etc/ssh/sshd_config but make
+ /etc/ssh/sshd_config.d/50-cloud-init.conf."""
+ mycfg = tmpdir.join("sshd_config")
+ os.mkdir(os.path.join(tmpdir, "sshd_config.d"))
+ assert ssh_util.update_ssh_config({"key": "value"}, mycfg)
+ expected_conf_file = f"{mycfg}.d/50-cloud-init.conf"
+ assert os.path.isfile(expected_conf_file)
+ assert not os.path.isfile(mycfg)
+ assert "key value\n" == util.load_text_file(expected_conf_file)
+
@pytest.mark.parametrize(
"cfg",
["Include {mycfg}.d/*.conf", "Include {mycfg}.d/*.conf # comment"],