Skip to content
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

Drop --target-version parameter #911

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

ehelms
Copy link
Member

@ehelms ehelms commented Aug 14, 2024

This parameter is no longer used by the upgrade runner as it is defined internally by the scenarios.

@lpramuk
Copy link

lpramuk commented Aug 18, 2024

Almost LGTM.

However I've found out an issue after an upgrade to 6.16 is performed:

  1. Patch stream with upstream
# wget -O- https://github.com/theforeman/foreman_maintain/pull/911.diff | patch -N -p1 -d /usr/share/gems/gems/foreman_maintain-*
  1. Upgrade to 6.16
# satellite-maintain upgrade run -y -w repositories-validate,repositories-setup,non-rh-packages
Checking for new version of satellite-maintain...
Nothing to update, can't find new version of satellite-maintain.
Running preparation steps required to run the next scenarios
...

--------------------------------------------------------------------------------
Upgrade finished.
  1. Run upgrade once more
# satellite-maintain upgrade run -y -w repositories-validate,repositories-setup,non-rh-packages
Checking for new version of satellite-maintain...
Security: kernel-core-4.18.0-553.16.1.el8_10.x86_64 is an installed security update
Security: kernel-core-4.18.0-553.8.1.el8_10.x86_64 is the currently running version
Nothing to update, can't find new version of satellite-maintain.
undefined method `target_version' for nil:NilClass

it should just say "Nothing to update....." w/o any error

@phase = :pre_upgrade_checks
condition = { :tags => [:upgrade_scenario, phase] }
matching_scenarios = find_scenarios(condition)
@version = matching_scenarios.first.target_version
Copy link

Choose a reason for hiding this comment

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

if next scenario is not installed (next maintenance is not enabled) and you run "upgrade" then it produces:

undefined method `target_version' for nil:NilClass

Is question mark missing?

Suggested change
@version = matching_scenarios.first.target_version
@version = matching_scenarios.first.target_version?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@version = matching_scenarios.first.target_version
@version = matching_scenarios.first&.target_version

Safe operator is &, but I wonder what else that might break

Copy link
Member

Choose a reason for hiding this comment

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

[root@sat-stream-qa-rhel8 ~]# foreman-maintain upgrade check
Checking for new version of satellite-maintain...
Nothing to update, can't find new version of satellite-maintain.
[root@sat-stream-qa-rhel8 ~]# foreman-maintain upgrade run
Checking for new version of satellite-maintain...
Nothing to update, can't find new version of satellite-maintain.
--------------------------------------------------------------------------------
Upgrade finished.

This doesn't look correct to me. I'd have expected an error "there is nothing to upgrade to" or something like that.

Copy link

@lpramuk lpramuk left a comment

Choose a reason for hiding this comment

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

Please fix

undefined method `target_version' for nil:NilClass

when next scenario is not yet installed

@ehelms ehelms force-pushed the drop-target-version branch 2 times, most recently from f34dd75 to c18b493 Compare August 19, 2024 17:42
@ehelms
Copy link
Member Author

ehelms commented Aug 19, 2024

Updated and here is the new output:

          Checking for new version of rubygem-foreman_maintain...
          Nothing to update, can't find new version of rubygem-foreman_maintain.

          There are no upgrades available.
          The current version of FakeyFakeFake is 3.14.
          Consider using the update command.

Feel free to suggest any word smithing.

This parameter is no longer used by the upgrade runner as it is
defined internally by the scenarios.
@evgeni evgeni merged commit c5890ab into theforeman:master Aug 20, 2024
8 checks passed
@lpramuk
Copy link

lpramuk commented Aug 20, 2024

@ehelms I can't re-test since there are other missing changes that you have rebased on

@lpramuk
Copy link

lpramuk commented Aug 21, 2024

Now it is more broken:

# rpm -q satellite rubygem-foreman_maintain
satellite-6.15.3-1.el8sat.noarch
rubygem-foreman_maintain-1.7.0-1.el8sat.noarch

# dnf repolist
Updating Subscription Management repositories.
repo id                                                                                       repo name
Satellite_Engineering_Satellite_stream_Composes_Satellite_Maintenance_stream_RHEL8            Satellite Maintenance Stream RHEL8
Satellite_Engineering_Satellite_stream_Composes_Satellite_stream_RHEL8                        Satellite Stream RHEL8
rhel-8-for-x86_64-appstream-rpms                                                              Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                                                 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

# satellite-maintain upgrade run -y -w repositories-validate,repositories-setup,non-rh-packages 
Checking for new version of satellite-maintain...
Nothing to update, can't find new version of satellite-maintain.

There are no upgrades available.
The current version of Satellite is 6.15.
Consider using the update command.

I can't upgrade at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants