From baa09bc26c1daee43cf4bddecdd50ebeef177821 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 15 Sep 2017 07:02:47 -0700 Subject: [PATCH] log2zulip: Clean up extra config path and add comments. That extra complexity isn't particularly valuable. --- zulip/integrations/log2zulip/log2zulip | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zulip/integrations/log2zulip/log2zulip b/zulip/integrations/log2zulip/log2zulip index 219699d..fdb5c19 100755 --- a/zulip/integrations/log2zulip/log2zulip +++ b/zulip/integrations/log2zulip/log2zulip @@ -100,15 +100,16 @@ if __name__ == "__main__": parser = zulip.add_default_arguments(argparse.ArgumentParser()) # type: argparse.ArgumentParser3 parser.add_argument("--control-path", default="/etc/log2zulip.conf") args = parser.parse_args() - # On posix systems, we set the config directory explicitly for legacy reasons. - if not args.zulip_config_file and os.name == "posix": - args.zulip_config_file = "/etc/log2zulip.zuliprc" lock_path = os.path.join(temp_dir, "log2zulip.lock") if os.path.exists(lock_path): + # This locking code is here to protect against log2zulip, + # running in a cron job, ending up with multiple copies + # running at the same time. print("Log2zulip lock held; not doing anything") sys.exit(0) + # TODO: Convert this locking code to use a standard context manager. try: open(lock_path, "w").write("1") zulip_client = zulip.init_from_options(args)