]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
teuthology: fix for ssh-keys-task
authorJoe Buck <jbbuck@gmail.com>
Fri, 5 Apr 2013 00:47:29 +0000 (17:47 -0700)
committerJoe Buck <jbbuck@gmail.com>
Mon, 8 Apr 2013 18:54:55 +0000 (11:54 -0700)
Resolves an issue where we
were not properly escaping the generated
public key when doing matches against it.

Signed-off-by: Joe Buck <jbbuck@gmail.com>
Reviewd-by: Sam Lang <sam.lang@inktank.com>
teuthology/task/ssh_keys.py

index 60fcacfd6c28970298cdd8069d7c3e5de15f9f3e..94b43f823fbed5eb462e75caa5cc6c5b4f99a43a 100644 (file)
@@ -21,10 +21,9 @@ def generate_keys():
     return key.get_base64(), privateString.getvalue()
 
 def particular_ssh_key_test(line_to_test, ssh_key):
-    match = re.match('[\w-]+ {key} \S+@\S+'.format(key=ssh_key), line_to_test)
+    match = re.match('[\w-]+ {key} \S+@\S+'.format(key=re.escape(ssh_key)), line_to_test)
 
     if match:
-        log.info('found matching ssh_key line: {line}'.format(line=line_to_test))
         return False
     else:
         return True
@@ -33,7 +32,6 @@ def ssh_keys_user_line_test(line_to_test, username ):
     match = re.match('[\w-]+ \S+ {username}@\S+'.format(username=username), line_to_test)
 
     if match:
-        log.info('found a ssh-keys-user line: {line}'.format(line=line_to_test))
         return False
     else:
         return True
@@ -96,6 +94,8 @@ def tweak_ssh_config(ctx, config):
 @contextlib.contextmanager
 def push_keys_to_host(ctx, config, public_key, private_key):   
 
+    log.info('generated public key {pub_key}'.format(pub_key=public_key))
+
     # add an entry for all hosts in ctx to auth_keys_data
     auth_keys_data = ''