From cc0b8f16068cdf72a05e16cb5b548f51d940eacf Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 5 May 2022 11:07:28 +0200 Subject: [PATCH] Never require login in the help command --- osc/cmdln.py | 2 ++ osc/commandline.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/osc/cmdln.py b/osc/cmdln.py index f5459a57..50ec6172 100644 --- a/osc/cmdln.py +++ b/osc/cmdln.py @@ -326,6 +326,8 @@ class RawCmdln(cmd.Cmd): if self.optparser: # i.e. optparser=None means don't process for opts try: self.options, args = self.optparser.parse_args(argv[1:]) + # store args so we can use them in self.postoptparse() + self.args = args except CmdlnUserError as ex: msg = "%s: %s\nTry '%s help' for info.\n"\ % (self.name, ex, self.name) diff --git a/osc/commandline.py b/osc/commandline.py index 5be025f9..92e8c4ad 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -133,6 +133,11 @@ class Osc(cmdln.Cmdln): def postoptparse(self): """merge commandline options into the config""" + + if self._get_canonical_cmd_name(self.args[0]) == "help": + # avoid loading config that may trigger prompt for username, password etc. + return + try: conf.get_config(override_conffile = self.options.conffile, override_apiurl = self.options.apiurl,