aboutsummaryrefslogtreecommitdiffstats
path: root/teamspeak-multi.py
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2018-10-19 01:21:34 +0200
committernico <nico@magicbroccoli.de>2018-10-19 01:21:34 +0200
commit6dc39c0a80de3c15451461eba8d2ad72bab834d3 (patch)
tree33fec8295bd96286786e65369cdad2df79ff63e2 /teamspeak-multi.py
parent7cda651e217e29ee55ff4e34d4f167ce8fc171f2 (diff)
* fixed IndexError
Diffstat (limited to 'teamspeak-multi.py')
-rwxr-xr-xteamspeak-multi.py23
1 files 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()