From e6f94c9d3db6021aff4443bf06dd34a49d53ba20 Mon Sep 17 00:00:00 2001 From: Mike Blume Date: Thu, 3 Oct 2013 18:00:49 -0700 Subject: [PATCH] detect platform, fail if it's not linux LOGGLY-4184 --- configure-syslog.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/configure-syslog.py b/configure-syslog.py index 0736e59..bf7d0c9 100755 --- a/configure-syslog.py +++ b/configure-syslog.py @@ -1478,6 +1478,15 @@ def parse_options(): (options, args) = parser.parse_args() return options +def assert_os(): + platform = sys.platform + # maybe also allow freebsd or sunos? + if not platform.startswith('linux'): + printLog("This script is only designed to run under linux, not %s" % + platform) + log({"platform": platform}) + sys.exit(1) + # Script starts here def main(): try: @@ -1498,6 +1507,7 @@ def main(): "operating_system": current_environment['operating_system'], "syslog_versions": [ {"daemon": d, "version": v} for d,v in current_environment['syslog_versions'] ] }) + assert_os() call_module(options.action, current_environment) printMessage("Finished") log({"status":"finish", "args": vars(options)})