Skip to content

Commit 7cc9632

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix insecure/verify options"
2 parents f8bbbdc + 12f1bdd commit 7cc9632

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

‎openstackclient/shell.py‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ def build_option_parser(self, description, version):
187187
verify_group = parser.add_mutually_exclusive_group()
188188
verify_group.add_argument(
189189
'--verify',
190-
action='store_true',
190+
default=None,
191+
action='store_false',
191192
help='Verify server certificate (default)',
192193
)
193194
verify_group.add_argument(
194195
'--insecure',
196+
default=None,
195197
action='store_true',
196198
help='Disable server certificate verification',
197199
)
@@ -224,12 +226,6 @@ def initialize_app(self, argv):
224226
# Parent __init__ parses argv into self.options
225227
super(OpenStackShell, self).initialize_app(argv)
226228

227-
# Resolve the verify/insecure exclusive pair here as cloud_config
228-
# doesn't know about verify
229-
self.options.insecure = (
230-
self.options.insecure and not self.options.verify
231-
)
232-
233229
# Set the default plugin to token_endpoint if rl and token are given
234230
if (self.options.url and self.options.token):
235231
# Use service token authentication
@@ -253,10 +249,8 @@ def initialize_app(self, argv):
253249
if cacert:
254250
self.verify = cacert
255251
else:
256-
self.verify = not getattr(self.cloud.config, 'insecure', False)
257-
258-
# Neutralize verify option
259-
self.options.verify = None
252+
self.verify = not self.cloud.config.get('insecure', False)
253+
self.verify = self.cloud.config.get('verify', self.verify)
260254

261255
# Save default domain
262256
self.default_domain = self.options.os_default_domain

0 commit comments

Comments
 (0)