almeidajeff commented on PR #3681: URL: https://github.com/apache/ambari/pull/3681#issuecomment-1521675455
Evaluating the [rpm_check_package_available](https://github.com/wuzhuoming/ambari-python3/blob/AMBARI-25854-release-2.7.5/ambari-common/src/main/python/ambari_commons/repo_manager/yum_manager.py#L344) method, it uses the python rpm library which is also discontinued for Python3, as a suggestion we can use the os module to execute the rpm command. Segue uma sugestão de como ficaria o método: ``` def rpm_check_package_available(self, name): import os packages = os.popen("rpm -qa --queryformat '%{name} '").read().split() name_regex = re.escape(name).replace("\\?", ".").replace("\\*", ".*") + '$' regex = re.compile(name_regex) return any(regex.match(package) for package in packages) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
