yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #73034
[Bug 1677205] Re: cloud-init eats final EOL of sshd_config
This bug is believed to be fixed in cloud-init in version
18.2-27-g6ef92c98-0ubuntu1~18.04.1. If this is still a problem for you,
please make a comment and set the state back to New
Thank you.
** Also affects: cloud-init (Ubuntu)
Importance: Undecided
Status: New
** Changed in: cloud-init (Ubuntu)
Assignee: (unassigned) => Chad Smith (chad.smith)
** Changed in: cloud-init
Assignee: (unassigned) => Scott Moser (smoser)
** Changed in: cloud-init (Ubuntu)
Importance: Undecided => Medium
** Changed in: cloud-init
Status: Fix Committed => Fix Released
** Changed in: cloud-init (Ubuntu)
Status: New => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1677205
Title:
cloud-init eats final EOL of sshd_config
Status in cloud-init:
Fix Released
Status in cloud-init package in Ubuntu:
Fix Released
Bug description:
cloud-init reads in sshd_config, and then writes it out again, but
eats the final newline.
It also changes the file mode to 644, which I don't like since the
original was 600, but I haven't yet found a decent way to change that.
While I'm at it, spellcheck in comment.
HAND
diff --git a/cloudinit/config/cc_set_passwords.py b/cloudinit/config/cc_set_passwords.py
index eb0bdab0..ed30a9d9 100755
--- a/cloudinit/config/cc_set_passwords.py
+++ b/cloudinit/config/cc_set_passwords.py
@@ -215,7 +215,7 @@ def handle(_name, cfg, cloud, log, args):
pw_auth))
lines = [str(l) for l in new_lines]
- util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines))
+ util.write_file(ssh_util.DEF_SSHD_CFG, "\n".join(lines)+"\n")
try:
cmd = cloud.distro.init_cmd # Default service
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 33019579..a8e84da8 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1691,7 +1691,7 @@ def chmod(path, mode):
def write_file(filename, content, mode=0o644, omode="wb"):
"""
Writes a file with the given content and sets the file mode as specified.
- Resotres the SELinux context if possible.
+ Restores the SELinux context if possible.
@param filename: The full path of the file to write.
@param content: The content to write to the file.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1677205/+subscriptions
References