Skip to content

Conversation

@phillxnet
Copy link
Member

@phillxnet phillxnet commented May 23, 2025

Remove DNF/YUM use for all current distro targets, replace primary prior function with zypper-changelog-lib.

Fixes #2979
Fixes #2983
Fixes #2984
Fixes #2485
Fixes #2285
Fixes #2286

Includes:

  • Remove all DNF/YUM use project wide, entailing the removal of the CentOS 'rockstor' distro.id target within pkg_mgmt.py.
  • Use zypper-changelog-lib, a Rockstor spin-off library, for pending 'rockstor' package changelog retrieval. Replaces prior primary purpose of DNF/YUM.
  • Add password-store sync for Web-UI changelog repo authentication: zypper-changelog-lib.
  • Make switch_repo() zypper only and remove run_command() use in favour of 'zypper --xmlout' specific wrappers.
  • Add pkg_update_info(), a zypper wrapper, to replaces the YUM/DNF cascade calls of now removed pkg_update_check(), pkg_changelog(), and pkg_infos().
  • Remove unused downgrade_pkg(): used YUM.
  • Remove sole users of install_pkg(): smartmontools is installed via rpm dependency.
  • Move storageadmin exception handle from using rpm_build_info(), YUM dependency, to current_version(); an rpm wrapper.
  • Enhance current_version(), along with added test coverage.
  • Bundled fix for "Fix UnboundLocalError: local variable 'appliance'" UnboundLocalError: cannot access local variable 'appliance' #2983
  • Fix Installed/Available package versions not appearing in available update details Available and installed pkg versions not shown #2984.
  • Prioritise rockstor changelog retrieval over updates-list retrieval by delaying the latter - packaging lock contention issue.
  • Enact limited zypper re-trys re error 7 (zypper busy), logging either way: non-zero code(7) returned by zypper when rapidly refreshing #2485
  • Improve logging during repo change process.
  • Remove/remark-out redundant/excessive logging.
  • Associated performance improvement with all of the above rationalisations. Web UI delay/timeout while waiting on yum info installed #2285 Web UI delay/timeout while waiting on yum changelog #2286
  • Associated type-hint improvements and re-Black formatting.
  • User hint re possible page refresh requirement: no changelog displayed.
  • Avoid re-direct by using updated url: re paid support.

Note associated rpmbuild changes addressed in:

Caveat

There is the following know header indicator regression.
As per the faked scenario re older 'rockstor' version DB wise, in order that this branch sees its own rpm as an update, we are missing the 'rockstor' package update available Web-UI header indicator up-arrow to the right of the current version (top-right) indication:

missing-indicator-bug

With the above image taken from a system otherwise detailing both a changelog and newer version details , via 'SYSTEM -> Software Updates', as well as the same Installed/Available details displayed within the generalised flashing 'wifi' like indicator:

Existing-notification-re-rockstor-update-available

which in turn gives directions towards the dedicated page. Given this redundancy, it is proposed that this know regression is spun-off into a dedicated issue. Likely to be addressed during the next testing phase; with a possible cherry-pick to pending next Stable phase.

Remove DNF/YUM use for all current distro targets, replace primary
prior function with zypper-changelog-lib.

# Includes:
- Remove all DNF/YUM use project wide, entailing the removal of the CentOS 'rockstor' distro.id target within pkg_mgmt.py.
- Use zypper-changelog-lib, a Rockstor spin-off library, for pending 'rockstor' package changelog retrieval. Replaces prior primary purpose of DNF/YUM.
- Add password-store sync for Web-UI changelog repo authentication: zypper-changelog-lib.
- Make switch_repo() zypper only and remove run_command() use in favour of 'zypper --xmlout' specific wrappers.
- Add pkg_update_info(), a zypper wrapper, to replaces the YUM/DNF cascade calls of now removed pkg_update_check(), pkg_changelog(), and pkg_infos().
- Remove unused downgrade_pkg(): used YUM.
- Remove sole users of install_pkg(): smartmontools is installed via rpm dependency.
- Move storageadmin exception handle from using rpm_build_info(), YUM dependency, to current_version(); an rpm wrapper.
- Enhance current_version(), along with added test coverage.
- Bundled fix for "Fix UnboundLocalError: local variable 'appliance'" rockstor#2983
- Fix Installed/Available package versions not appearing in available update details rockstor#2984.
- Prioritise rockstor changelog retrieval over updates-list retrieval by delaying the latter - packaging lock contention issue.
- Enact limited zypper re-trys re error 7 (zypper busy), logging either way: rockstor#2485
- Improve logging during repo change process.
- Remove/remark-out redundant/excessive logging.
- Associated performance improvement with all of the above rationalisations. rockstor#2285 rockstor#2286
- Associated type-hint improvements and re-Black formatting.
- User hint re possible page refresh requirement: no changelog displayed.
- Avoid re-direct by using updated url: re paid support.
@phillxnet
Copy link
Member Author

phillxnet commented May 23, 2025

Testing

Available packages & rockstor repo config & switch

As these tests were conducted on fresh installs, and this branch specific unreleased version is newer than any yet released in the public repos, a pending 'rockstor' package changelog test will follow by way of a follow-up comment here.

An rpm was built and installed on both a Leap 15.6 and a Slowroll instance.

  1. Initial Web-UI "Rockstor Setup" step completed.
  2. "No Thanks" to pop-up re Selecting a Rockstor update repository.
  3. Flashing 'wifi' icon indicating OS updates appears with a few seconds), which now includes versions info - including those of the 'rockstor' package. The Leap 15.6 host had around 55 updates pending, while the Slowroll host had around 300 pending updates.
  4. Both host examples also correctly displayed the installed rpm as 5.0.15-2985.
  5. Clicking on top-right header "ROCKSTOR 5.0.15-2985" entry, akin to SYSTEM -> Software Update, and we have the channel selection displayed as intended
  6. Testing repo activation succeeded in establishing the intended repo config, confirmed via command line zypper lr -U | grep "Rockstor".
  7. Stable repo activation (from Testing activation in 6.) also succeeded similarly.
  8. Steps 6. & 7. were reversed for the Slowroll client to test for order sensitivity regarding fresh installs, with the initial activation in this case using an incorrect authentication credentials, resulting in the expected red dialog stating:

Activation code (wrong-activation-code) could not be authorized for your appliance (duff-applianceID). Verify the code and try again. If the problem persists, email [email protected] with this message.

Multiple subsequent back-and-forth selections between the currently two update repo selections were also tested there-after with the expected repo configuration resulting.

@phillxnet
Copy link
Member Author

Testing pending 'rockstor' update changelog.

As mentioned in the prior comment, this rpm is the latest, so to test its significantly modified pkg management/reporting code, as if there were a newer rpms version available, we need to fake such a situation.

The following procedure was followed.

Leap 15.6 x86_64 host.

This patch's associated rpm was uninstalled, and the install directory removed, and any repositories that may have been configured; followed by the installation of a 5.0.13-0 rpm but only for rpm DB purposes, as we need to test the existing code in the context of a newer changelog available. Hence faking an older rpm as being installed.

zypper remove rockstor
rm -rf /opt/rockstor/
zypper removerepo Rockstor-Testing Rockstor-Stable

This branches test rpm was then re-installed but its services were not started - they are not auto-started by the rpm itself by design, and the subsequent files were then moved aside:

zypper in rockstor-5.0.15-2985
mv /opt/rockstor /opt/rockstor-temp

The above rpm removal process was then re-run to assert a 5.0.13-0 install (by rpm db); now that we have a clean copy of the files installed by a 5.0.15-2985 tucked-away (bar the rpm scriptlet functions re files) :

zypper remove rockstor
# lots of expected warnings re files not found: they were move beforehand.
zypper addrepo --refresh http://updates.rockstor.com:8999/rockstor-testing/leap/15.6 Rockstor-Testing
zypper removerepo Rockstor-Testing

And finally to supplanting the files of 5.0.13-0 with those of this proposed patch, while leaving the systems packaging subsystem only aware of the 5.0.13-0 install:

mv /opt/rockstor /opt/rockstor-5.0.13-0
mv /opt/rockstor-temp/ /opt/rockstor
grep "Version" /opt/rockstor/PKG-INFO
...
Version: 5.0.15
rpm -q --queryformat %{VERSION}\-%{RELEASE}\\\n%{BUILDTIME:day} rockstor
5.0.13-0
Wed Jul 17 2024

@phillxnet
Copy link
Member Author

On from the convoluted fake 5.0.13-0 install (rpm DB wise) that is actually a 5.0.15-2985 (this branch) install (files wise), we can now initiate its systemd services chain via:

systemctl enable --now rockstor-bootstrap.service
  1. The Web-UI "Rockstor Setup" stage (be sure to no re-use the prior admin use if you have not already - `userdel username''d them.
  2. "Update Now" via pop-up dialog.
  3. The resulting "Software Update" page shows the rpm DB derived version of 5.0.13-0 as intended.
  4. Active Testing
  5. "Rockstor 5.0.15-0 update is available!" is displayed in green and we have the expected changelog between the rpm DB version of 5.0.13-0 and the last published in testing (with rpm changelog entries) of 5.0.15-0; i.e. the changes associated with 5.0.14-0, and the changes within 5.0.15-0:

proposed-code-faked-as-5 0 13-0

And we see from the rockstor.log that this was retrieved via our spin-off zypper-changelog-lib library, as well as pkg_mgmt's log of the general updates list being skipped due to a zypper lock - likely held by zypper-changelog-lib at that time. The pending base OS updates list will be re-scanned on any subsequent page refresh.

[23/May/2025 18:05:24] INFO [system.pkg_mgmt:571] Skipped fetching updates, zypper busy.
[23/May/2025 18:05:26] INFO [zypper_changelog_lib.zyppchangelog:527] Assuming repo requires no authentication

@phillxnet
Copy link
Member Author

If we now supplant the Web-UI configured 'real' Rockstor-Testing repo with one that has as the latest rpm, the one build for this patch/PR:

zypper removerepo Rockstor-Testing
zypper addrepo --refresh http://machine.lan:8999/rockstor-testing/leap/15.6 Rockstor-Testing

We see after a page refresh the following version offered:

Rockstor 5.0.15-2985 update is available!

5 0 15-2985-available-version

With the same changelog as before as we do not incorporate changelog changes between published/tagged rpm releases. And so it remains the same as our last 5.0.15-0 release, at least until we rebuild this rpm with a prepared changelog patch.

@phillxnet
Copy link
Member Author

Note also that we now have, as part of this patch, an absolute timeout set for base OS pending updates info retrieval:

[23/May/2025 18:37:35] ERROR [system.pkg_mgmt:579] Consider applying updates to reduce backlog: Command '['zypper', '--xmlout', 'list-updates']' timed out after 15 seconds

Visible via the Web-UI Log Manager feature:
zypper_list-updates_timeout-log-entry

This timeout can occur during repo or internet slow-downs and is not immediately retried as this check is on a timer or re-done on every browser paget refresh. Repo additions/removals are however on auto retry as a way to circumvent transient zypper locking.

@phillxnet
Copy link
Member Author

phillxnet commented May 24, 2025

Using the faked 5.0.13-0 (by rpm DB) but actually running this branches code, we have a successfull all-except-rockstor package update via the "updates to the base OS (system updates)" option documented here (flahsing wifi icon):
https://rockstor.com/docs/installation/install.html#install-updates-from-the-web-ui

Resulting in only the 'rockstor' package remaining in this list, by way of a redundant notifier, and versions indicator:
All-bar-rockstor-updated-successfully

Note the before state of this same system & dialog in the original proposal text: 'Caveat' section.

@phillxnet
Copy link
Member Author

Further to the last comment, our faked as 5.0.13-0 (in rpm DB) branch code successfully updated to its own rpm instance via the Web-UI.

@phillxnet
Copy link
Member Author

On the basis of the tests detailed in the prior comments, I'll move to merge these changes which are likely larger that would be ideal; especially given our late testing phase status. However we were between a rock and a hard place here re our own prior dnf-yum related dependencies potentially holding up other OS wide updates.

@phillxnet phillxnet merged commit f7732ac into rockstor:testing May 24, 2025
@phillxnet phillxnet deleted the 2979-Remove-dnf-yum-use branch May 24, 2025 10:23
@phillxnet
Copy link
Member Author

phillxnet commented May 30, 2025

From rpm release 5.1.0-0, the first to include this patch, the following will remove the now unused dnf-yum related packages:

zypper remove --clean-deps dnf libdnf2 libdnf5_2

The above covers both Leap and Tumbleweed-Slowroll OS bases, as such it will not find all packages requested for removal on any one system. It is expected that around 20 packages will be removed by this command.

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.

1 participant