Giuseppe Lavagetto has submitted this change and it was merged. Change subject: conftool: adjust logging, allow --debug for both tools ......................................................................
conftool: adjust logging, allow --debug for both tools Change-Id: I016e5f477a6141a446359af87b61ce1c83781462 --- M conftool/cli/syncer.py M conftool/cli/tool.py M conftool/drivers/etcd.py M debian/changelog 4 files changed, 24 insertions(+), 4 deletions(-) Approvals: Giuseppe Lavagetto: Verified; Looks good to me, approved diff --git a/conftool/cli/syncer.py b/conftool/cli/syncer.py index 486cc4c..043b9fa 100644 --- a/conftool/cli/syncer.py +++ b/conftool/cli/syncer.py @@ -143,8 +143,11 @@ parser = argparse.ArgumentParser(description="Tool to sync the declared " "configuration on-disk with the kvstore " "data") - parser.add_argument('--directory', help="Directory containing the files to sync") + parser.add_argument('--directory', + help="Directory containing the files to sync") parser.add_argument('--config', help="Configuration file") + parser.add_argument('--debug', action="store_true", + default=False, help="print debug info") return parser.parse_args(args) @@ -154,7 +157,6 @@ arguments.pop(0) args = get_args(arguments) - logging.basicConfig(level=logging.DEBUG) try: c = configuration.get(args.config) KVObject.setup(c) @@ -162,6 +164,12 @@ raise _log.critical("Invalid configuration: %s", e) sys.exit(1) + + if args.debug: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.WARN) + files = tag_files(args.directory) # Load services data. # TODO: This must be fixed to be less specific diff --git a/conftool/cli/tool.py b/conftool/cli/tool.py index a18127d..23e8717 100644 --- a/conftool/cli/tool.py +++ b/conftool/cli/tool.py @@ -33,8 +33,15 @@ help="the action to take: " " [set/k1=v1:k2=v2...|get|delete] node", nargs=2, required=True) + parser.add_argument('--debug', action="store_true", + default=False, help="print debug info") args = parser.parse_args(cmdline) - logging.basicConfig(level=logging.WARN) + + if args.debug: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.WARN) + try: c = configuration.get(args.config) KVObject.setup(c) diff --git a/conftool/drivers/etcd.py b/conftool/drivers/etcd.py index 8ef9b48..b5ac8f2 100644 --- a/conftool/drivers/etcd.py +++ b/conftool/drivers/etcd.py @@ -15,7 +15,6 @@ proto = urlparse.urlparse(config.hosts[0]).scheme self.client = etcd.Client(host=tuple(host_list), protocol=proto, - allow_reconnect=True, **config.driver_options) super(Driver, self).__init__(config) diff --git a/debian/changelog b/debian/changelog index 5aa84a1..2354539 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-conftool (0.0.2) precise-wikimedia; urgency=medium + + * Add the debug option, fix etcd driver arguments + + -- Giuseppe Lavagetto <glavage...@wikimedia.org> Tue, 16 Jun 2015 14:52:15 +0200 + python-conftool (0.0.1) unstable; urgency=medium * Initial packaging -- To view, visit https://gerrit.wikimedia.org/r/218611 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I016e5f477a6141a446359af87b61ce1c83781462 Gerrit-PatchSet: 2 Gerrit-Project: operations/software/conftool Gerrit-Branch: master Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org> Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits