Various commits to enable no-shell or safe-shell usage, more to come.

This commit is contained in:
Michael DeHaan 2014-03-12 16:44:03 -04:00
parent 60a7f57300
commit 6010e74839
6 changed files with 29 additions and 22 deletions

View file

@ -51,6 +51,7 @@ EXAMPLES = '''
- opkg: name=foo,bar state=absent
'''
import pipes
def update_package_db(module, opkg_path):
""" Updates packages list. """
@ -66,7 +67,7 @@ def query_package(module, opkg_path, name, state="present"):
if state == "present":
rc, out, err = module.run_command("%s list-installed | grep -q ^%s" % (opkg_path, name))
rc, out, err = module.run_command("%s list-installed | grep -q ^%s" % (pipes.quote(opkg_path), pipes.quote(name)), use_unsafe_shell=True)
if rc == 0:
return True