Skip to content

Commit 0314035

Browse files
Merge pull request #4408 from fwolfsjaeger/rabbitmqadmin-fix-reading-config
Fixed reading SSL settings from rabbitmqadmin config file
2 parents a9cc401 + 648812e commit 0314035

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

deps/rabbitmq_management/bin/rabbitmqadmin

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ default_options = {"hostname": "localhost",
331331
"username": "guest",
332332
"password": "guest",
333333
"ssl": False,
334+
"ssl_insecure": False,
335+
"ssl_disable_hostname_verification": False,
334336
"request_timeout": 120,
335337
"verbose": True,
336338
"format": "table",
@@ -393,9 +395,9 @@ def make_parser():
393395
add("--ssl-ca-cert-file", dest="ssl_ca_cert_file",
394396
help="PEM format CA certificate file for SSL")
395397
add("--ssl-disable-hostname-verification", dest="ssl_disable_hostname_verification",
396-
help="Disables peer hostname verification", default=False, action="store_true")
398+
help="Disables peer hostname verification", action="store_true")
397399
add("-k", "--ssl-insecure", dest="ssl_insecure",
398-
help="Disables all SSL validations like curl's '-k' argument", default=False, action="store_true")
400+
help="Disables all SSL validations like curl's '-k' argument", action="store_true")
399401
add("-t", "--request-timeout", dest="request_timeout",
400402
help="HTTP request timeout in seconds", type="int")
401403
add("-f", "--format", dest="format",
@@ -470,13 +472,14 @@ def merge_config_file_options(cli_options, final_options):
470472
assert_usage(False, msg)
471473
else:
472474
for key, section_val in section_settings.items():
473-
# special case --ssl
474-
if key == 'ssl':
475+
# if CLI options contain this key, do not set it from the config file
476+
if getattr(cli_options, key) is not None:
477+
continue
478+
# special case for boolean values
479+
if section_val == "True" or section_val == "False":
475480
setattr(final_options, key, section_val == "True")
476481
else:
477-
# if CLI options do not contain this key, set it from the config file
478-
if getattr(cli_options, key) is None:
479-
setattr(final_options, key, section_val)
482+
setattr(final_options, key, section_val)
480483
return final_options
481484

482485
def expand_base_uri_options(cli_options, final_options):

0 commit comments

Comments
 (0)