|
|
@ -63,7 +63,7 @@ def query_package(module, name, state="installed"):
|
|
|
|
|
|
|
|
|
|
|
|
if state == "installed":
|
|
|
|
if state == "installed":
|
|
|
|
|
|
|
|
|
|
|
|
rc = os.system("%s list | grep ^%s" % (PKGIN_PATH, name))
|
|
|
|
(rc, stdout, stderr) = module.run_command("%s list | grep ^%s" % (PKGIN_PATH, name))
|
|
|
|
|
|
|
|
|
|
|
|
if rc == 0:
|
|
|
|
if rc == 0:
|
|
|
|
return True
|
|
|
|
return True
|
|
|
@ -80,7 +80,7 @@ def remove_packages(module, packages):
|
|
|
|
if not query_package(module, package):
|
|
|
|
if not query_package(module, package):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
rc = os.system("%s -y remove %s" % (PKGIN_PATH, package))
|
|
|
|
module.run_command("%s -y remove %s" % (PKGIN_PATH, package))
|
|
|
|
|
|
|
|
|
|
|
|
if query_package(module, package):
|
|
|
|
if query_package(module, package):
|
|
|
|
module.fail_json(msg="failed to remove %s" % (package))
|
|
|
|
module.fail_json(msg="failed to remove %s" % (package))
|
|
|
@ -102,7 +102,7 @@ def install_packages(module, packages):
|
|
|
|
if query_package(module, package):
|
|
|
|
if query_package(module, package):
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
rc = os.system("%s -y install %s" % (PKGIN_PATH, package))
|
|
|
|
module.run_command("%s -y install %s" % (PKGIN_PATH, package))
|
|
|
|
|
|
|
|
|
|
|
|
if not query_package(module, package):
|
|
|
|
if not query_package(module, package):
|
|
|
|
module.fail_json(msg="failed to install %s" % (package))
|
|
|
|
module.fail_json(msg="failed to install %s" % (package))
|
|
|
|