From 7cee903118c2f1adf7effcabe921e699ad5181c3 Mon Sep 17 00:00:00 2001 From: "Ryan S. Brown" Date: Tue, 21 Feb 2017 15:27:23 -0500 Subject: [PATCH] [cluster] Name Consul dynamic inventory config consistently w/ the script --- contrib/inventory/{consul.ini => consul_io.ini} | 0 contrib/inventory/consul_io.py | 9 ++++++--- 2 files changed, 6 insertions(+), 3 deletions(-) rename contrib/inventory/{consul.ini => consul_io.ini} (100%) diff --git a/contrib/inventory/consul.ini b/contrib/inventory/consul_io.ini similarity index 100% rename from contrib/inventory/consul.ini rename to contrib/inventory/consul_io.ini diff --git a/contrib/inventory/consul_io.py b/contrib/inventory/consul_io.py index 24808333e3c..27406c6167b 100755 --- a/contrib/inventory/consul_io.py +++ b/contrib/inventory/consul_io.py @@ -37,7 +37,7 @@ This script can be run with the switches --datacenter, to restrict the nodes to a single datacenter --host to restrict the inventory to a single named node. (requires datacenter config) -The configuration for this plugin is read from a consul.ini file located in the +The configuration for this plugin is read from a consul_io.ini file located in the same directory as this inventory script. All config options in the config file are optional except the host and port, which must point to a valid agent or server running the http api. For more information on enabling the endpoint see. @@ -420,9 +420,12 @@ class ConsulConfig(dict): return False def read_settings(self): - ''' Reads the settings from the consul.ini file ''' + ''' Reads the settings from the consul_io.ini file (or consul.ini for backwards compatibility)''' config = ConfigParser.SafeConfigParser() - config.read(os.path.dirname(os.path.realpath(__file__)) + '/consul.ini') + if os.path.isfile(os.path.dirname(os.path.realpath(__file__)) + '/consul_io.ini'): + config.read(os.path.dirname(os.path.realpath(__file__)) + '/consul_io.ini') + else: + config.read(os.path.dirname(os.path.realpath(__file__)) + '/consul.ini') config_options = ['host', 'token', 'datacenter', 'servers_suffix', 'tags', 'kv_metadata', 'kv_groups', 'availability',