From 826ad0d816b1820fb444d33aff0019652cc0ade3 Mon Sep 17 00:00:00 2001 From: Joe Buck Date: Thu, 4 Apr 2013 17:47:29 -0700 Subject: [PATCH] teuthology: fix for ssh-keys-task Resolves an issue where we were not properly escaping the generated public key when doing matches against it. Signed-off-by: Joe Buck Reviewd-by: Sam Lang --- teuthology/task/ssh_keys.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/teuthology/task/ssh_keys.py b/teuthology/task/ssh_keys.py index 60fcacfd6c289..94b43f823fbed 100644 --- a/teuthology/task/ssh_keys.py +++ b/teuthology/task/ssh_keys.py @@ -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 = '' -- 2.39.5