From: Zack Cerza Date: Tue, 17 Sep 2013 23:04:04 +0000 (-0500) Subject: Make sed expressions safe to run multiple times X-Git-Tag: 1.1.0~1870^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bbda7522c6432c3e982c45a2bcd2f3cae6727f56;p=teuthology.git Make sed expressions safe to run multiple times Also, make them ignore commented lines. --- diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index 9541c07b1..30d480756 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(