From bbda7522c6432c3e982c45a2bcd2f3cae6727f56 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 17 Sep 2013 18:04:04 -0500 Subject: [PATCH] Make sed expressions safe to run multiple times Also, make them ignore commented lines. --- teuthology/task/internal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 9541c07b16..30d4807564 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -288,8 +288,8 @@ def sudo(ctx, config): log.info('Configuring sudo...') sudoers_file = '/etc/sudoers' backup_ext = '.orig.teuthology' - tty_expr = 's/requiretty/!requiretty/' - pw_expr = 's/!visiblepw/visiblepw/' + tty_expr = 's/^\([^#]*\) \(requiretty\)/\1 !\2/g' + pw_expr = 's/^\([^#]*\) !\(visiblepw\)/\1 \2/g' run.wait( ctx.cluster.run( -- 2.39.5