This is an automated email from the ASF dual-hosted git repository. yjhjstz pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 3c8f63c22b98c0149dd4d871f42e737c5eba233a Author: Xing Guo <[email protected]> AuthorDate: Wed Nov 22 14:39:09 2023 +0800 Don't emit critical error message when gppkg is missing. (#16747) Gppkg for Greenplum 7 is closed source and we don't ship it for OSS users. This patch helps suppress the error message when gppkg is missing. Co-authored-by: Zhaolong Li <[email protected]> --- gpMgmt/bin/gppylib/commands/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gpMgmt/bin/gppylib/commands/base.py b/gpMgmt/bin/gppylib/commands/base.py index 8201a727bc..9848142507 100755 --- a/gpMgmt/bin/gppylib/commands/base.py +++ b/gpMgmt/bin/gppylib/commands/base.py @@ -649,7 +649,7 @@ class CommandNotFoundException(Exception): return "Could not locate command: '%s' in this set of paths: %s" % (self.cmd, repr(self.paths)) -def findCmdInPath(cmd): +def findCmdInPath(cmd, missing_ok=False): # ---------------command path-------------------- CMDPATH = ['/usr/kerberos/bin', '/usr/sfw/bin', '/opt/sfw/bin', '/bin', '/usr/local/bin', '/usr/bin', '/sbin', '/usr/sbin', '/usr/ucb', '/sw/bin', '/opt/Navisphere/bin'] @@ -669,7 +669,11 @@ def findCmdInPath(cmd): CMD_CACHE[cmd] = f return f - logger.critical('Command %s not found' % cmd) + # missing_ok is just suppressing the critical log message. This function + # still raises an exception and leaves the client to decide whether to + # consume the error. + if not missing_ok: + logger.critical('Command %s not found' % cmd) search_path = CMDPATH[:] raise CommandNotFoundException(cmd, search_path) else: --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
