diff --git a/awx/plugins/fact_caching/tower.py b/awx/plugins/fact_caching/tower.py index bb35ebaec4..1072ae90f8 100755 --- a/awx/plugins/fact_caching/tower.py +++ b/awx/plugins/fact_caching/tower.py @@ -53,7 +53,8 @@ class CacheModule(BaseCacheModule): self.socket = self.context.socket(zmq.REQ) self.socket.connect(self._tower_connection) except Exception, e: - print("Connection to zeromq failed at %s" % str(self._tower_connection)) + print("Connection to zeromq failed at %s with error: %s" % (str(self._tower_connection), + str(e))) sys.exit(1) def get(self, key): diff --git a/awx/plugins/library/scan_packages.py b/awx/plugins/library/scan_packages.py index 00188d686f..5d5737d5c4 100755 --- a/awx/plugins/library/scan_packages.py +++ b/awx/plugins/library/scan_packages.py @@ -6,20 +6,31 @@ from ansible.module_utils.basic import * def rpm_package_list(): import rpm trans_set = rpm.TransactionSet() - installed_packages = [] + installed_packages = {} for package in trans_set.dbMatch(): - installed_packages.append({'name': package['name'], - 'version': "%s" % (package['version'])}) + package_details = dict(name=package[rpm.RPMTAG_NAME], + version=package[rpm.RPMTAG_VERSION], + release=package[rpm.RPMTAG_RELEASE], + epoch=package[rpm.RPMTAG_EPOCH], + arch=package[rpm.RPMTAG_ARCH], + source='rpm') + if package['name'] not in installed_packages: + installed_packages[package['name']] = [package_details] + else: + installed_packages[package['name']].append(package_details) return installed_packages def deb_package_list(): import apt apt_cache = apt.Cache() - installed_packages = [] + installed_packages = {} apt_installed_packages = [pk for pk in apt_cache.keys() if apt_cache[pk].is_installed] for package in apt_installed_packages: - installed_packages.append({'name': package, - 'version': apt_cache[package].installed.version}) + ac_pkg = apt_cache[package].installed + package_details = dict(name=package, + version=ac_pkg.version, + architecture=ac_pkg.architecture) + installed_packages[package] = [package_details] return installed_packages def main():