From 8f5dc3e4c64f0ad9c0d3e0f78467e368acd7a149 Mon Sep 17 00:00:00 2001 From: Jeff Schroeder Date: Sat, 21 Jan 2012 21:38:58 -0800 Subject: [PATCH] Add puppet.noop --- salt/modules/puppet.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/salt/modules/puppet.py b/salt/modules/puppet.py index df68f9c242..177eb5ed5a 100644 --- a/salt/modules/puppet.py +++ b/salt/modules/puppet.py @@ -2,6 +2,7 @@ Execute puppet routines ''' +from salt.exceptions import CommandNotFoundError def _check_puppet(): ''' @@ -10,7 +11,7 @@ def _check_puppet(): # I thought about making this a virtual module, but then I realized that I # would require the minion to restart if puppet was installed after the # minion was started, and that would be rubbish - return __salt__['cmd.has_exec']('puppet') + return __salt__['cmd.has_exec']('puppetd') def run(): @@ -25,4 +26,18 @@ def run(): if _check_puppet(): return __salt__['cmd.run_all']('puppetd --test') else: - return {} + raise CommandNotFoundError("puppetd not available") + +def noop(): + ''' + Execute a puppet noop run and return a dict with the stderr,stdout,return code + etc. + + CLI Example:: + + salt '*' puppet.noop + ''' + if _check_puppet(): + return __salt__['cmd.run_all']('puppetd --test --noop') + else: + raise CommandNotFoundError("puppetd not available")