in src/core/src/package_managers/AptitudePackageManager.py [0:0]
def get_all_updates(self, cached=False):
"""Get all missing updates"""
all_updates = []
all_updates_versions = []
ubuntu_pro_client_all_updates_query_success = False
self.composite_logger.log_verbose("[APM] Discovering all packages...")
# use Ubuntu Pro Client cached list when the conditions are met.
if self.__pro_client_prereq_met and not len(self.ubuntu_pro_client_all_updates_cached) == 0:
all_updates = self.ubuntu_pro_client_all_updates_cached
all_updates_versions = self.ubuntu_pro_client_all_updates_versions_cached
elif not self.__pro_client_prereq_met and not len(self.all_updates_cached) == 0:
all_updates = self.all_updates_cached
all_updates_versions = self.all_update_versions_cached
if cached and not len(all_updates) == 0:
self.composite_logger.log_debug("[APM] Get all updates : [Cached={0}][PackagesCount={1}]]".format(str(cached), len(all_updates)))
return all_updates, all_updates_versions
# when cached is False, query both default way and using Ubuntu Pro Client.
source_parts, source_list = self.__get_custom_sources_to_spec(self.max_patch_publish_date, base_classification=str())
cmd = self.__generate_command_with_custom_sources(command_template=self.cmd_dist_upgrade_simulation_template, source_parts=source_parts, source_list=source_list)
out = self.invoke_package_manager(cmd)
self.all_updates_cached, self.all_update_versions_cached = self.extract_packages_and_versions(out)
if self.__pro_client_prereq_met:
ubuntu_pro_client_all_updates_query_success, self.ubuntu_pro_client_all_updates_cached, self.ubuntu_pro_client_all_updates_versions_cached = self.ubuntu_pro_client.get_all_updates()
pro_client_missed_updates = list(set(self.all_updates_cached) - set(self.ubuntu_pro_client_all_updates_cached))
all_updates_missed_updates = list(set(self.ubuntu_pro_client_all_updates_cached) - set(self.all_updates_cached))
self.composite_logger.log_debug("[APM-Pro] Get all updates : [DefaultAllPackagesCount={0}][UbuntuProClientQuerySuccess={1}][UbuntuProClientAllPackagesCount={2}]"
.format(len(self.all_updates_cached), ubuntu_pro_client_all_updates_query_success, len(self.ubuntu_pro_client_all_updates_cached)))
if len(pro_client_missed_updates) > 0: # not good, needs investigation
self.composite_logger.log_debug("[APM-Pro][!] Pro Client missed updates found. [Count={0}][Updates={1}]".format(len(pro_client_missed_updates), pro_client_missed_updates))
if len(all_updates_missed_updates) > 0: # interesting, for review
self.composite_logger.log_debug("[APM-Pro][*] Pro Client only updates found. [Count={0}][Updates={1}]".format(len(all_updates_missed_updates), all_updates_missed_updates))
if ubuntu_pro_client_all_updates_query_success: # this needs to be revisited based on logs above
return self.ubuntu_pro_client_all_updates_cached, self.ubuntu_pro_client_all_updates_versions_cached
else:
return self.all_updates_cached, self.all_update_versions_cached