-
Notifications
You must be signed in to change notification settings - Fork 20
Feature: Adding Rhel10 Base Support using dnf4 package manager #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
8934338
75fa11e
c5828f5
2675eff
2b7a745
dc345b8
19a86f7
a5b9564
a1c418b
4be3cbd
a7dba17
61627d4
51143e3
b3a331c
3efa978
0770a2e
c648f9e
4149007
bd153e4
ae5b7d7
029f67c
39ebb10
98b7ede
3b259ec
b35d0c0
99f21c7
940cada
5509481
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,6 +81,21 @@ def is_distro_rhel_10(self, distro_name): | |
| """ Checks if the current distro is RHEL 10 """ | ||
| return self.__is_matching_distro_and_version(distro_name, Constants.RED_HAT, version_to_match=10) | ||
|
|
||
| def __is_dnf_available(self): | ||
| code, _ = self.run_command_output('which dnf', False, False) | ||
| return code == 0 | ||
|
|
||
| def __get_dnf_version(self): | ||
| code, out = self.run_command_output('dnf --version', False, False) | ||
| # Output : dnf5 version 5.2.18.0/ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is the / at the end of this comment intended?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, earlier I had dnf5 version 5.2.18.0/4.20.0 but updated later. Removed / from the end |
||
| # Output : 4.20.0 | ||
| if code != 0 or not out: | ||
| return code, out, None | ||
|
|
||
| first_line = str(out).splitlines()[0].strip() | ||
| version = first_line.split()[-1] | ||
| return code, out, version | ||
|
|
||
| def get_package_manager(self): | ||
| # type: () -> str | ||
| """ Detects package manager type """ | ||
|
|
@@ -93,8 +108,16 @@ def get_package_manager(self): | |
|
|
||
| # Check for unsupported distros | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update comment. Rhel10 no longer unsupported.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated |
||
| if self.is_distro_rhel_10(os_name): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be expanded backwards later if shown to be stable (RHEL 9 for e.g.)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the method to a generic name and added comment for future when we plan to expand. Right now, the is_distro_rhel method only checks for version 10 but we can update the version in future. |
||
| error_msg = "This distro is not yet supported in your region. Please review https://aka.ms/VMGuestPatchingCompatibility for more information. [Distro={0}][Version={1}][Code={2}]".format(str(os_name), os_version, os_code) | ||
| print("Error: {0}".format(error_msg)) | ||
| if not self.__is_dnf_available(): | ||
| print("Error: Expected package manager dnf not found on this rhel 10 VM.") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would prefer if you matched the original error message formatting.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RHEL in caps always
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| return str() | ||
| code, out, version = self.__get_dnf_version() | ||
| if version: | ||
| if version.startswith('4'): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment here on the dnf5 PR. Also, I think we may want to split the version comparison into a separate function rather than having a lot of duplicate code. Something like a shared "check_major_version" function
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Working on this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated this |
||
| return Constants.DNF4 | ||
| print("Error: Expected dnf version 4 on this rhel 10 VM. Found: {0}".format(version)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| return str() | ||
| print("Error: Unable to determine dnf version. Code={0}, Output={1}".format(code, out)) | ||
| return str() | ||
|
|
||
| # Check for Azure Linux 4 or Above( uses dnf5) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.