You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ha...@apache.org on 2019/04/11 09:14:22 UTC
[ambari] branch trunk updated: AMBARI-25207 The Ubuntu repository
id for the cached apt package list is generated wrong in case if were used
URL with https protocol (dgrinenko) (#2919)
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
The following commit(s) were added to refs/heads/trunk by this push:
new e694998 AMBARI-25207 The Ubuntu repository id for the cached apt package list is generated wrong in case if were used URL with https protocol (dgrinenko) (#2919)
e694998 is described below
commit e694998eca8657e3c85016a2fb6e875bc5b973e5
Author: Dmytro Grinenko <ha...@gmail.com>
AuthorDate: Thu Apr 11 12:14:15 2019 +0300
AMBARI-25207 The Ubuntu repository id for the cached apt package list is generated wrong in case if were used URL with https protocol (dgrinenko) (#2919)
---
.../python/ambari_commons/repo_manager/apt_manager.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
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 c986e3b..5126533 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
@@ -151,6 +151,20 @@ class AptManager(GenericManager):
def all_packages(self, pkg_names=None, repo_filter=None):
return self.available_packages(pkg_names, repo_filter)
+ def transform_baseurl_to_repoid(self, base_url):
+ """
+ Transforms the URL looking like proto://localhost/some/long/path to localhost_some_long_path
+
+ :type base_url str
+ :rtype str
+ """
+ url_proto_mask = "://"
+ url_proto_pos = base_url.find(url_proto_mask)
+ if url_proto_pos > 0:
+ base_url = base_url[url_proto_pos+len(url_proto_mask):]
+
+ return base_url.replace("/", "_").replace(" ", "_")
+
def get_available_packages_in_repos(self, repos):
"""
Gets all (both installed and available) packages that are available at given repositories.
@@ -163,7 +177,7 @@ class AptManager(GenericManager):
repo_ids = []
for repo in repos.items:
- repo_ids.append(repo.base_url.replace("http://", "").replace("/", "_"))
+ repo_ids.append(self.transform_baseurl_to_repoid(repo.base_url))
if repos.feat.scoped:
Logger.info("Looking for matching packages in the following repositories: {0}".format(", ".join(repo_ids)))