in src/core/src/package_managers/YumPackageManager.py [0:0]
def __init__(self, env_layer, execution_config, composite_logger, telemetry_writer, status_handler):
super(YumPackageManager, self).__init__(env_layer, execution_config, composite_logger, telemetry_writer, status_handler)
# Repo refresh
# There is no command as this is a no op.
# Support to get updates and their dependencies
self.yum_check = 'sudo yum -q check-update'
self.yum_check_security_prerequisite = 'sudo yum -y install yum-plugin-security'
self.yum_check_security = 'sudo yum -q --security check-update'
self.single_package_check_versions = 'sudo yum list available <PACKAGE-NAME> --showduplicates'
self.single_package_check_installed = 'sudo yum list installed <PACKAGE-NAME>'
self.single_package_upgrade_simulation_cmd = 'LANG=en_US.UTF8 sudo yum install --assumeno --skip-broken '
# Install update
self.single_package_upgrade_cmd = 'sudo yum -y install --skip-broken '
self.all_but_excluded_upgrade_cmd = 'sudo yum -y update --exclude='
# Package manager exit code(s)
self.yum_exitcode_no_applicable_packages = 0
self.yum_exitcode_ok = 1
self.yum_exitcode_updates_available = 100
# Support to check for processes requiring restart
self.yum_utils_prerequisite = 'sudo yum -y install yum-utils'
self.needs_restarting = 'sudo LANG=en_US.UTF8 needs-restarting'
self.needs_restarting_with_flag = 'sudo LANG=en_US.UTF8 needs-restarting -r'
self.yum_ps_prerequisite = 'sudo yum -y install yum-plugin-ps'
self.yum_ps = 'sudo yum ps'
# 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 YUM Cron service
self.__init_constants_for_yum_cron()
# commands for DNF Automatic updates service
self.__init_constants_for_dnf_automatic()
# commands for PackageKit service
self.__init_constants_for_packagekit()
# Miscellaneous
self.set_package_manager_setting(Constants.PKG_MGR_SETTING_IDENTITY, Constants.YUM)
self.STR_TOTAL_DOWNLOAD_SIZE = "Total download size: "
# if an Auto Patching request comes in on a CentOS machine with Security and/or Critical classifications selected, we need to install all patches
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 'CentOS' in 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 CentOS machines")
execution_config.included_classifications_list = [Constants.PackageClassification.CRITICAL, Constants.PackageClassification.SECURITY, Constants.PackageClassification.OTHER]
# Known errors and the corresponding action items
self.known_errors_and_fixes = {"SSL peer rejected your certificate as expired": self.fix_ssl_certificate_issue,
"Error: Cannot retrieve repository metadata (repomd.xml) for repository": self.fix_ssl_certificate_issue,
"Error: Failed to download metadata for repo": self.fix_ssl_certificate_issue}
self.yum_update_client_package = "sudo yum update -y --disablerepo='*' --enablerepo='*microsoft*'"
self.package_install_expected_avg_time_in_seconds = 90 # As per telemetry data, the average time to install package is around 90 seconds for yum.