Updating how to run commands in check mode, standarizing quotes

pull/2043/head
Chris Hoffman 12 years ago
parent 2c947c2ed6
commit ca3b8228f7

@ -54,23 +54,21 @@ examples:
class RabbitMqPlugins(object): class RabbitMqPlugins(object):
def __init__(self, module): def __init__(self, module):
self.module = module self.module = module
self._rabbitmq_plugins = module.get_bin_path("rabbitmq-plugins", True) self._rabbitmq_plugins = module.get_bin_path('rabbitmq-plugins', True)
def _exec(self, args): def _exec(self, args, run_in_check_mode=False):
cmd = [self._rabbitmq_plugins] cmd = [self._rabbitmq_plugins]
rc, out, err = self.module.run_command(cmd + args, check_rc=True) rc, out, err = self.module.run_command(cmd + args, check_rc=True)
return out.splitlines() return out.splitlines()
def get_all(self): def get_all(self):
return self._exec(["list", "-E", "-m"]) return self._exec(['list', '-E', '-m'], True)
def enable(self, name): def enable(self, name):
if not self.module.check_mode: self._exec(['enable', name])
self._exec(["enable", name])
def disable(self, name): def disable(self, name):
if not self.module.check_mode: self._exec(['disable', name])
self._exec(["disable", name])
def main(): def main():
arg_spec = dict( arg_spec = dict(

Loading…
Cancel
Save