This is an automated email from the ASF dual-hosted git repository. hapylestat pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
commit fb178d2fa3cdf6f2586648264a1888357dd95a3f Author: Dmitry Grinenko <[email protected]> AuthorDate: Fri Apr 27 20:46:29 2018 +0300 initial --- .../src/main/python/ambari_commons/repo_manager/apt_manager.py | 3 +++ .../src/main/python/ambari_commons/repo_manager/yum_manager.py | 3 +++ .../src/main/python/ambari_commons/repo_manager/zypper_manager.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py b/ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py index 38cf602..76d31f1 100644 --- a/ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py +++ b/ambari-common/src/main/python/ambari_commons/repo_manager/apt_manager.py @@ -304,5 +304,8 @@ class AptManager(GenericManager): apt-get in inconsistant state (locked, used, having invalid repo). Once packages are installed we should not rely on that. """ + if not name: + raise ValueError("Package name can't be empty") + r = shell.subprocess_executor(self.properties.check_cmd % name) return not bool(r.code) diff --git a/ambari-common/src/main/python/ambari_commons/repo_manager/yum_manager.py b/ambari-common/src/main/python/ambari_commons/repo_manager/yum_manager.py index 5e404b1..6a2b629 100644 --- a/ambari-common/src/main/python/ambari_commons/repo_manager/yum_manager.py +++ b/ambari-common/src/main/python/ambari_commons/repo_manager/yum_manager.py @@ -263,6 +263,9 @@ class YumManager(GenericManager): yum in inconsistant state (locked, used, having invalid repo). Once packages are installed we should not rely on that. """ + if not name: + raise ValueError("Package name can't be empty") + if os.geteuid() == 0: return self.yum_check_package_available(name) else: diff --git a/ambari-common/src/main/python/ambari_commons/repo_manager/zypper_manager.py b/ambari-common/src/main/python/ambari_commons/repo_manager/zypper_manager.py index 8617ef9..9f6f09a 100644 --- a/ambari-common/src/main/python/ambari_commons/repo_manager/zypper_manager.py +++ b/ambari-common/src/main/python/ambari_commons/repo_manager/zypper_manager.py @@ -282,4 +282,7 @@ class ZypperManager(GenericManager): zypper in inconsistant state (locked, used, having invalid repo). Once packages are installed we should not rely on that. """ + if not name: + raise ValueError("Package name can't be empty") + return self.rpm_check_package_available(name) -- To stop receiving notification emails like this one, please contact [email protected].
