Improved error message for remote version package output

This commit is contained in:
2025-07-09 23:20:11 -05:00
parent b91cf18b04
commit 47b2aabd9f
8 changed files with 45 additions and 25 deletions

View File

@ -90,11 +90,11 @@ func (y *YumManager) CheckVersion(pkgs []packagemanagercommon.Package) (string,
}
// Parse parses the dnf info output to extract Installed and Candidate versions.
func (y YumManager) ParseRemotePackageManagerVersionOutput(output string) ([]packagemanagercommon.Package, []error) {
func (y YumManager) ParseRemotePackageManagerVersionOutput(output string) ([]packagemanagercommon.Package, error) {
// Check for error message in the output
if strings.Contains(output, "No matching packages to list") {
return nil, []error{fmt.Errorf("error: package not listed")}
return nil, fmt.Errorf("error: package not listed")
}
// Define regular expressions to capture installed and available versions
@ -116,7 +116,7 @@ func (y YumManager) ParseRemotePackageManagerVersionOutput(output string) ([]pac
}
if installedVersion == "" && candidateVersion == "" {
return nil, []error{fmt.Errorf("failed to parse versions from dnf output")}
return nil, fmt.Errorf("failed to parse versions from dnf output")
}
return nil, nil