Remove spaces from Sahara key comment

This is breaking nova keypair creation and seems to be
a regression in nova (https://bugs.launchpad.net/nova/+bug/1481084)

According to the sshd man page the optional key comment field
should be ignored.

Change-Id: I5e6f03c7a7848b049766a57e2a30d0819b58904f
This commit is contained in:
Trevor McKay 2015-08-03 16:48:34 -04:00
parent 93f92068f0
commit 2341faf8bc
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ class CryptoTest(testtools.TestCase):
self.assertIn('-----BEGIN RSA PRIVATE KEY-----', kp[0]) self.assertIn('-----BEGIN RSA PRIVATE KEY-----', kp[0])
self.assertIn('-----END RSA PRIVATE KEY-----', kp[0]) self.assertIn('-----END RSA PRIVATE KEY-----', kp[0])
self.assertIn('ssh-rsa ', kp[1]) self.assertIn('ssh-rsa ', kp[1])
self.assertIn('Generated by Sahara', kp[1]) self.assertIn('Generated-by-Sahara', kp[1])
def test_to_paramiko_private_key(self): def test_to_paramiko_private_key(self):
pk_str = c.generate_key_pair()[0] pk_str = c.generate_key_pair()[0]

View File

@ -42,7 +42,7 @@ def generate_key_pair(key_length=2048):
'-N', '', # w/o passphrase '-N', '', # w/o passphrase
'-t', 'rsa', # create key of rsa type '-t', 'rsa', # create key of rsa type
'-f', keyfile, # filename of the key file '-f', keyfile, # filename of the key file
'-C', 'Generated by Sahara' # key comment '-C', 'Generated-by-Sahara' # key comment
] ]
if key_length is not None: if key_length is not None:
args.extend(['-b', key_length]) args.extend(['-b', key_length])