From 269ceada78fb8df59da3f02c1b6e21c5457b4206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Moser?= Date: Wed, 18 Sep 2013 09:56:30 +0200 Subject: [PATCH] zabbix inventory: print errors to stderr --- plugins/inventory/zabbix.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/inventory/zabbix.py b/plugins/inventory/zabbix.py index a161c63aea3..68cc5cc57b3 100755 --- a/plugins/inventory/zabbix.py +++ b/plugins/inventory/zabbix.py @@ -38,7 +38,7 @@ import ConfigParser try: from zabbix_api import ZabbixAPI except: - print "Error: Zabbix API library must be installed: pip install zabbix-api." + print >> sys.stderr, "Error: Zabbix API library must be installed: pip install zabbix-api." sys.exit(1) try: @@ -111,7 +111,7 @@ class ZabbixInventory(object): api = ZabbixAPI(server=self.zabbix_server) api.login(user=self.zabbix_username, password=self.zabbix_password) except BaseException, e: - print "Error: Could not login to Zabbix server. Check your zabbix.ini." + print >> sys.stderr, "Error: Could not login to Zabbix server. Check your zabbix.ini." sys.exit(1) if self.options.host: @@ -123,11 +123,11 @@ class ZabbixInventory(object): print json.dumps(data, indent=2) else: - print "usage: --list ..OR.. --host " + print >> sys.stderr, "usage: --list ..OR.. --host " sys.exit(1) else: - print "Error: Configuration of server and credentials are required. See zabbix.ini." + print >> sys.stderr, "Error: Configuration of server and credentials are required. See zabbix.ini." sys.exit(1) ZabbixInventory()