From 6dc39c0a80de3c15451461eba8d2ad72bab834d3 Mon Sep 17 00:00:00 2001 From: nico Date: Fri, 19 Oct 2018 01:21:34 +0200 Subject: * fixed IndexError --- teamspeak-multi.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/teamspeak-multi.py b/teamspeak-multi.py index fc2de6b..e38d6cf 100755 --- a/teamspeak-multi.py +++ b/teamspeak-multi.py @@ -149,17 +149,18 @@ class TeamspeakMulti: def main(self): # check if first argument is config or autoconf if not fetch data - if sys.argv[1] == "config": - for key in self.config().keys(): - print('\n'.join(self.config()[key])) - if os.environ.get('MUNIN_CAP_DIRTYCONFIG') == '1': - self.run() - elif sys.argv[1] == 'autoconf': - if None in {os.environ.get('username'), os.environ.get('password')}: - print('yes') - else: - print('env variables are missing') - else: + try: + if sys.argv[1] == "config": + for key in self.config().keys(): + print('\n'.join(self.config()[key])) + if os.environ.get('MUNIN_CAP_DIRTYCONFIG') == '1': + self.run() + elif sys.argv[1] == 'autoconf': + if None in {os.environ.get('username'), os.environ.get('password')}: + print('yes') + else: + print('env variables are missing') + except IndexError: self.run() -- cgit v1.2.3-54-g00ecf