Skip to content

Commit fa59309

Browse files
author
alexander popov
committed
fix: change option -M, change help if this option is not specified
1 parent c7577b1 commit fa59309

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

mamonsu/lib/parser.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
--old-zabbix
3838
HINT: By default, mamonsu exports the template for Zabbix 4.4 or higher.
3939
To export a template for older Zabbix versions, use the --old-zabbix option.
40+
"""
4041

42+
usage_msg_bootstrap = """
4143
Bootstrap DDL for monitoring:
4244
Command: bootstrap
4345
Examples:
@@ -48,8 +50,12 @@
4850
-W <PGPASSWORD>
4951
-d, --dbname <DBNAME>
5052
-U, --username <USERNAME>
51-
--host <PGHOST>
52-
53+
-h, --host <PGHOST>
54+
"""
55+
56+
usage_msg += usage_msg_bootstrap
57+
58+
usage_msg += """
5359
Information about working mamonsu:
5460
Command: agent
5561
Examples:
@@ -219,6 +225,9 @@ def print_help(self, **kwargs):
219225
""")
220226
sys.exit(2)
221227

228+
def print_bootstrap_help(self, **kwargs):
229+
print(usage_msg_bootstrap.format(prog=sys.argv[0]))
230+
222231
def _process_long_opt(self, rargs, values):
223232
try:
224233
OptionParser._process_long_opt(self, rargs, values)

mamonsu/tools/bootstrap/start.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def __init__(self):
5959
bootstrap_group.add_option(
6060
'-M', '--mamonsu-username',
6161
dest='mamonsu_username',
62-
default=self.default_user(),
6362
help='database non-privileged user for mamonsu')
6463
parser.add_option_group(group)
6564
parser.add_option_group(bootstrap_group)
@@ -73,7 +72,7 @@ def __init__(self):
7372
sys.exit(1)
7473
if self.args.mamonsu_username is None:
7574
sys.stderr.write("ERROR: Database non-privileged username for mamonsu is not specified\n")
76-
parser.print_help()
75+
parser.print_bootstrap_help()
7776
sys.exit(1)
7877

7978
if not self.args.dbname:

0 commit comments

Comments
 (0)