Merge ~larsks/cloud-init:fedora/1151824 into cloud-init:master

Proposed by Lars Kellogg-Stedman
Status: Merged
Merged at revision: 853df0a0e85002582694b88db886f206f64b23c7
Proposed branch: ~larsks/cloud-init:fedora/1151824
Merge into: cloud-init:master
Diff against target: 47 lines (+15/-1)
2 files modified
cloudinit/ssh_util.py (+3/-0)
tests/unittests/test_sshutil.py (+12/-1)
Reviewer Review Type Date Requested Status
cloud-init Commiters Pending
Review via email: mp+315263@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

The change looks fine, but I'd really like to have a test case showing the failure and it fixed.

testing cloudinit/config/cc_ssh.py:apply_credentials or even just
cloudinit/ssh_util.py:setup_user_keys would be great.

Revision history for this message
Lars Kellogg-Stedman (larsks) wrote :

I've provided an updated test. It fails under master, but succeeds with this patch applied.

Revision history for this message
Scott Moser (smoser) wrote :

Great, thank you!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
index be8a49e..b95b956 100644
--- a/cloudinit/ssh_util.py
+++ b/cloudinit/ssh_util.py
@@ -22,8 +22,11 @@ DEF_SSHD_CFG = "/etc/ssh/sshd_config"
22VALID_KEY_TYPES = (22VALID_KEY_TYPES = (
23 "dsa",23 "dsa",
24 "ecdsa",24 "ecdsa",
25 "ecdsa-sha2-nistp256",
25 "ecdsa-sha2-nistp256-cert-v01@openssh.com",26 "ecdsa-sha2-nistp256-cert-v01@openssh.com",
27 "ecdsa-sha2-nistp384",
26 "ecdsa-sha2-nistp384-cert-v01@openssh.com",28 "ecdsa-sha2-nistp384-cert-v01@openssh.com",
29 "ecdsa-sha2-nistp521",
27 "ecdsa-sha2-nistp521-cert-v01@openssh.com",30 "ecdsa-sha2-nistp521-cert-v01@openssh.com",
28 "ed25519",31 "ed25519",
29 "rsa",32 "rsa",
diff --git a/tests/unittests/test_sshutil.py b/tests/unittests/test_sshutil.py
index 55971b5..6d45f90 100644
--- a/tests/unittests/test_sshutil.py
+++ b/tests/unittests/test_sshutil.py
@@ -32,6 +32,11 @@ VALID_CONTENT = {
32 "YWpMfYdPUnE7u536WqzFmsaqJctz3gBxH9Ex7dFtrxR4qiqEr9Qtlu3xGn7Bw07"32 "YWpMfYdPUnE7u536WqzFmsaqJctz3gBxH9Ex7dFtrxR4qiqEr9Qtlu3xGn7Bw07"
33 "/+i1D+ey3ONkZLN+LQ714cgj8fRS4Hj29SCmXp5Kt5/82cD/VN3NtHw=="33 "/+i1D+ey3ONkZLN+LQ714cgj8fRS4Hj29SCmXp5Kt5/82cD/VN3NtHw=="
34 ),34 ),
35 'ecdsa-sha2-nistp256': (
36 "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBMy/WuXq5MF"
37 "r5hVQ9EEKKUTF7vUaOkgxUh6bNsCs9SFMVslIm1zM/WJYwUv52LdEePjtDYiV4A"
38 "l2XthJ9/bs7Pc="
39 )
35}40}
3641
37TEST_OPTIONS = (42TEST_OPTIONS = (
@@ -44,7 +49,13 @@ class TestAuthKeyLineParser(test_helpers.TestCase):
44 def test_simple_parse(self):49 def test_simple_parse(self):
45 # test key line with common 3 fields (keytype, base64, comment)50 # test key line with common 3 fields (keytype, base64, comment)
46 parser = ssh_util.AuthKeyLineParser()51 parser = ssh_util.AuthKeyLineParser()
47 for ktype in ['rsa', 'ecdsa', 'dsa']:52 ecdsa_types = [
53 'ecdsa-sha2-nistp256',
54 'ecdsa-sha2-nistp384',
55 'ecdsa-sha2-nistp521',
56 ]
57
58 for ktype in ['rsa', 'ecdsa', 'dsa'] + ecdsa_types:
48 content = VALID_CONTENT[ktype]59 content = VALID_CONTENT[ktype]
49 comment = 'user-%s@host' % ktype60 comment = 'user-%s@host' % ktype
50 line = ' '.join((ktype, content, comment,))61 line = ' '.join((ktype, content, comment,))

Subscribers

People subscribed via source and target branches