Skip to content

Commit adb874e

Browse files
committed
fix: added unknown options check
1 parent 33100aa commit adb874e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mamonsu/lib/parser.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,12 @@ def parse_args():
295295
parser.add_option('--zabbix-file', dest='zabbix_file', default='/var/log/mamonsu/localhost.log')
296296
# log level to send metrics
297297
parser.add_option('--zabbix-log-level', dest='zabbix_log_level', default='INFO')
298-
return parser.parse_args()
298+
299+
# check unknown options
300+
args, commands = parser.parse_args()
301+
for command in commands:
302+
if str(command).startswith('-'):
303+
if not parser.get_option(str(command)):
304+
print('ERROR! Unknown option ' + str(command))
305+
exit(22)
306+
return args, commands

0 commit comments

Comments
 (0)