From 25f595c2bada725e3b8d82a69e6fb0b680ff34f9 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 12 Jan 2015 18:52:25 +0100 Subject: [PATCH 1/2] Avoid to use the builtin 'echo' By default, the interpretation of escape characters could be disabled (bash) or enabled (dash). --- system/debconf.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/system/debconf.py b/system/debconf.py index 592c2c865c7..b5af4744d56 100644 --- a/system/debconf.py +++ b/system/debconf.py @@ -86,8 +86,6 @@ debconf: name='oracle-java7-installer' question='shared/accepted-oracle-license- debconf: name='tzdata' ''' -import pipes - def get_selections(module, pkg): cmd = [module.get_bin_path('debconf-show', True), pkg] rc, out, err = module.run_command(' '.join(cmd)) @@ -106,14 +104,14 @@ def get_selections(module, pkg): def set_selection(module, pkg, question, vtype, value, unseen): - data = ' '.join([ question, vtype, value ]) - setsel = module.get_bin_path('debconf-set-selections', True) - cmd = ["echo %s %s |" % (pipes.quote(pkg), pipes.quote(data)), setsel] + cmd = [setsel] if unseen: cmd.append('-u') - return module.run_command(' '.join(cmd), use_unsafe_shell=True) + data = ' '.join([pkg, question, vtype, value]) + + return module.run_command(cmd, data=data) def main(): From 40298a8f2422ab230b23f49e841855d6039dd1a8 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Mon, 12 Jan 2015 19:02:30 +0100 Subject: [PATCH 2/2] remove unused variable --- system/debconf.py | 1 - 1 file changed, 1 deletion(-) diff --git a/system/debconf.py b/system/debconf.py index b5af4744d56..0deaff25eb1 100644 --- a/system/debconf.py +++ b/system/debconf.py @@ -135,7 +135,6 @@ def main(): unseen = module.params["unseen"] prev = get_selections(module, pkg) - diff = '' changed = False msg = ""