in src/core/src/package_managers/TdnfPackageManager.py [0:0]
def __init__(self, env_layer, execution_config, composite_logger, telemetry_writer, status_handler):
super(TdnfPackageManager, self).__init__(env_layer, execution_config, composite_logger, telemetry_writer, status_handler)
# Repo refresh
self.cmd_clean_cache = "sudo tdnf clean expire-cache"
self.cmd_repo_refresh = "sudo tdnf -q list updates"
# Support to get updates and their dependencies
self.tdnf_check = 'sudo tdnf -q list updates'
self.single_package_check_versions = 'sudo tdnf list available <PACKAGE-NAME>'
self.single_package_check_installed = 'sudo tdnf list installed <PACKAGE-NAME>'
self.single_package_upgrade_simulation_cmd = 'sudo tdnf install --assumeno --skip-broken '
# Install update
self.single_package_upgrade_cmd = 'sudo tdnf -y install --skip-broken '
# Package manager exit code(s)
self.tdnf_exitcode_ok = 0
self.tdnf_exitcode_on_no_action_for_install_update = 8
self.commands_expecting_no_action_exitcode = [self.single_package_upgrade_simulation_cmd]
# Support to check for processes requiring restart
self.dnf_utils_prerequisite = 'sudo tdnf -y install dnf-utils'
self.needs_restarting_with_flag = 'sudo LANG=en_US.UTF8 needs-restarting -r'
# auto OS updates
self.current_auto_os_update_service = None
self.os_patch_configuration_settings_file_path = ''
self.auto_update_service_enabled = False
self.auto_update_config_pattern_match_text = ""
self.download_updates_identifier_text = ""
self.apply_updates_identifier_text = ""
self.enable_on_reboot_identifier_text = ""
self.enable_on_reboot_check_cmd = ''
self.enable_on_reboot_cmd = ''
self.installation_state_identifier_text = ""
self.install_check_cmd = ""
self.apply_updates_enabled = "Enabled"
self.apply_updates_disabled = "Disabled"
self.apply_updates_unknown = "Unknown"
# commands for DNF Automatic updates service
self.__init_constants_for_dnf_automatic()
# Miscellaneous
self.set_package_manager_setting(Constants.PKG_MGR_SETTING_IDENTITY, Constants.TDNF)
self.STR_TOTAL_DOWNLOAD_SIZE = "Total download size: "
self.version_comparator = VersionComparator()
# if an Auto Patching request comes in on a Azure Linux machine with Security and/or Critical classifications selected, we need to install all patches, since classifications aren't available in Azure Linux repository
installation_included_classifications = [] if execution_config.included_classifications_list is None else execution_config.included_classifications_list
if execution_config.health_store_id is not str() and execution_config.operation.lower() == Constants.INSTALLATION.lower() \
and (env_layer.is_distro_azure_linux(str(env_layer.platform.linux_distribution()))) \
and 'Critical' in installation_included_classifications and 'Security' in installation_included_classifications:
self.composite_logger.log_debug("Updating classifications list to install all patches for the Auto Patching request since classification based patching is not available on Azure Linux machines")
execution_config.included_classifications_list = [Constants.PackageClassification.CRITICAL, Constants.PackageClassification.SECURITY, Constants.PackageClassification.OTHER]
self.package_install_expected_avg_time_in_seconds = 90 # Setting a default value of 90 seconds as the avg time to install a package using tdnf, might be changed later if needed.