From de7ba0a08c3efe3d4a4455432d34baefaaa5fe20 Mon Sep 17 00:00:00 2001 From: Mark Hamilton Date: Mon, 24 Aug 2015 13:45:12 -0700 Subject: [PATCH] using module.get_bin_path to find ovs-vsctl --- lib/ansible/modules/extras/network/openvswitch_db.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/extras/network/openvswitch_db.py b/lib/ansible/modules/extras/network/openvswitch_db.py index 320fdf87d3d..d5bc5bc7f37 100644 --- a/lib/ansible/modules/extras/network/openvswitch_db.py +++ b/lib/ansible/modules/extras/network/openvswitch_db.py @@ -68,7 +68,7 @@ EXAMPLES = ''' - openvswitch_db: table=open_vswitch record=. col=other_config key=max-idle value=50000 -# Disable in band +# Disable in band copy - openvswitch_db: table=Bridge record=br-int col=other_config key=disable-in-band value=true ''' @@ -76,6 +76,7 @@ EXAMPLES = ''' def cmd_run(module, cmd, check_rc=True): """ Log and run ovs-vsctl command. """ + syslog.syslog(syslog.LOG_NOTICE, cmd) return module.run_command(cmd.split(" "), check_rc=check_rc) @@ -84,13 +85,18 @@ def params_set(module): changed = False - fmt = "ovs-vsctl -t %(timeout)s get %(table)s %(record)s %(col)s:%(key)s" + ## + # Place in params dictionary in order to support the string format below. + module.params["ovs-vsctl"] = module.get_bin_path("ovs-vsctl", True) + + fmt = "%(ovs-vsctl)s -t %(timeout)s get %(table)s %(record)s " \ + "%(col)s:%(key)s" cmd = fmt % module.params (_, output, _) = cmd_run(module, cmd, False) if module.params['value'] not in output: - fmt = "ovs-vsctl -t %(timeout)s set %(table)s %(record)s " \ + fmt = "%(ovs-vsctl)s -t %(timeout)s set %(table)s %(record)s " \ "%(col)s:%(key)s=%(value)s" cmd = fmt % module.params ##