From 3e6eeeb371650f9e2bc68eecc8c0e727be906297 Mon Sep 17 00:00:00 2001 From: Thomas S Hatch Date: Sat, 30 Apr 2011 17:43:07 -0600 Subject: [PATCH] Add is_installed to the pacman module --- salt/modules/pacman.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/salt/modules/pacman.py b/salt/modules/pacman.py index b0cbe4b2f9..5b9574e8b9 100644 --- a/salt/modules/pacman.py +++ b/salt/modules/pacman.py @@ -21,6 +21,19 @@ def _list_removed(old, new): pkgs.append(pkg) return pkgs +def is_installed(pkg): + ''' + Returns a bool if the package is installed or not + + CLI Example: + salt '*' pkg.is_installed + ''' + pkgs = list_pkgs() + if pkgs.has_key(name): + return pkgs[name] + else: + return '' + def list_pkgs(): ''' List the packages currently installed in a dict: