From 0243eec2a69fb34d2ded8032ea71db9e0ff9ff96 Mon Sep 17 00:00:00 2001 From: RJ Nowling Date: Tue, 14 Apr 2015 12:02:32 -0500 Subject: [PATCH] Make 'module' global. Small whitespace formatting fixes. Closes Issue #397. --- lib/ansible/modules/extras/system/gluster_volume.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/system/gluster_volume.py b/lib/ansible/modules/extras/system/gluster_volume.py index e04df48d5f4..c1607f627c3 100644 --- a/lib/ansible/modules/extras/system/gluster_volume.py +++ b/lib/ansible/modules/extras/system/gluster_volume.py @@ -134,6 +134,7 @@ glusterbin = '' def run_gluster(gargs, **kwargs): global glusterbin + global module args = [glusterbin] args.extend(gargs) try: @@ -146,6 +147,7 @@ def run_gluster(gargs, **kwargs): def run_gluster_nofail(gargs, **kwargs): global glusterbin + global module args = [glusterbin] args.extend(gargs) rc, out, err = module.run_command(args, **kwargs) @@ -155,6 +157,7 @@ def run_gluster_nofail(gargs, **kwargs): def run_gluster_yes(gargs): global glusterbin + global module args = [glusterbin] args.extend(gargs) rc, out, err = module.run_command(args, data='y\n') @@ -240,6 +243,7 @@ def wait_for_peer(host): return False def probe(host): + global module run_gluster([ 'peer', 'probe', host ]) if not wait_for_peer(host): module.fail_json(msg='failed to probe peer %s' % host) @@ -285,18 +289,19 @@ def add_brick(name, brick, force): run_gluster(args) def do_rebalance(name): - run_gluster(['volume', 'rebalance', name, 'start']) + run_gluster([ 'volume', 'rebalance', name, 'start' ]) def enable_quota(name): run_gluster([ 'volume', 'quota', name, 'enable' ]) def set_quota(name, directory, value): - run_gluster([ 'volume', 'quota', name, 'limit-usage', directory, value ]) + run_gluster([ 'volume', 'quota', name, 'limit-usage', directory, value ]) def main(): ### MAIN ### + global module module = AnsibleModule( argument_spec=dict( name=dict(required=True, default=None, aliases=['volume']),