Skip to content

Conversation

feng-j678
Copy link
Contributor

@feng-j678 feng-j678 commented Apr 28, 2025

[x] apply ssl expired cmd fix only to rhel images
[x] pending unit tests
image

@feng-j678 feng-j678 changed the title Bugfix/apply microsoft repo cmd to rhel os only Bugfix: Apply SSL expired cmd to RHEL images only Apr 28, 2025
@feng-j678 feng-j678 changed the title Bugfix: Apply SSL expired cmd to RHEL images only Bugfix: Apply SSL expired cmd fix to RHEL images only Apr 28, 2025
Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.04%. Comparing base (97667b9) to head (55e1046).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
- Coverage   93.15%   93.04%   -0.11%     
==========================================
  Files         103      103              
  Lines       17608    17663      +55     
==========================================
+ Hits        16402    16435      +33     
- Misses       1206     1228      +22     
Flag Coverage Δ
python27 93.03% <100.00%> (-0.11%) ⬇️
python312 93.04% <100.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kjohn-msft kjohn-msft added the bug Something isn't working label Apr 28, 2025
@feng-j678 feng-j678 force-pushed the Bugfix/apply_microsoft_repo_cmd_to_rhel_os_only branch from a4d0bb8 to d150a83 Compare May 1, 2025 17:05
@feng-j678 feng-j678 force-pushed the Bugfix/apply_microsoft_repo_cmd_to_rhel_os_only branch from d150a83 to b488dfc Compare May 1, 2025 17:09
@feng-j678 feng-j678 marked this pull request as ready for review May 2, 2025 05:01
@Copilot Copilot AI review requested due to automatic review settings May 2, 2025 05:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the SSL certificate update command to apply only to RHEL images and introduces unit tests to cover success and failure cases.

  • Updated tests in Test_YumPackageManager.py for SSL certificate issue on both RHEL and non-RHEL images
  • Modified YumPackageManager.py to conditionally run the SSL fix based on the image type and adjusted error logging
  • Removed the unused yum_update_client_package attribute and inlined its value for clarity

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/core/tests/Test_YumPackageManager.py Added unit tests to verify SSL issue fix behavior for various OS
src/core/src/package_managers/YumPackageManager.py Adjusted logic for RHEL image detection and SSL fix, updated log text
Comments suppressed due to low confidence (1)

src/core/src/package_managers/YumPackageManager.py:926

  • [nitpick] There is an inconsistency in the log prefix '[YMP]' compared to other messages that use '[YPM]'. Consider unifying the prefixes for consistency.
error_msg = '[YMP] Customer environment error (Unable to auto-mitigate known issue):  [Out={0}]'.format(output)

self.assertTrue('Customer environment error (expired SSL certs)' in str(context.exception))

# Restore mock
self.runtime.env_layer.platform.extract_linux_distribution_os_info = original_env_layer_platform_linux_distribution
Copy link
Preview

Copilot AI May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears the restoration of the platform function is targeting 'extract_linux_distribution_os_info', which is inconsistent with the earlier usage of 'linux_distribution'. This may lead to unexpected behavior in subsequent tests; consider restoring the correct attribute.

Suggested change
self.runtime.env_layer.platform.extract_linux_distribution_os_info = original_env_layer_platform_linux_distribution
self.runtime.env_layer.platform.linux_distribution = original_env_layer_platform_linux_distribution

Copilot uses AI. Check for mistakes.

code, output = self.__read_record(operation)
return eval(output)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert - avoid file touches that are not really changes

Comment on lines -179 to +177
if self.env_layer.platform.linux_distribution() is not None:
if self.env_layer.platform.linux_distribution is not None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants