1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Avoid to use the builtin 'echo'

By default, the interpretation of escape characters could be disabled (bash)
or enabled (dash).
This commit is contained in:
Pierre-Louis Bonicoli 2015-01-12 18:52:25 +01:00 committed by Matt Clay
parent 99bcf18410
commit 993da476a0

View file

@ -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():