-
Notifications
You must be signed in to change notification settings - Fork 24
Optionally disallow patching if packages have not been predownloaded yet #6
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a986ed6
disallow-downloading-when-patching: initial version
moio 5ba8981
disallow-downloading-when-patching: correct PR ref
moio a867b61
disallow-downloading-when-patching: yum/dnf clarified
moio 1cdd828
Change the design to more easily allow non-SUSE distros in future
moio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
- Feature Name: disallow-downloading-when-patching | ||
- Start Date: 29-03-2919 | ||
- RFC PR: https://github.com/uyuni-project/uyuni-rfc/pull/6 | ||
|
||
# Summary | ||
Optionally fail package installations and patch applications if they require any downloading. | ||
|
||
This is limited to minions: SUSE based distros initially, Red Hat based distros as a stretch goal, with design in place for Debian based distros. | ||
|
||
# Motivation | ||
Minions with limited connectivity options might have little bandwidth available or bandwidth usage could come with a high cost (eg. in remote areas). In those cases we want users to be fully in control of when downloading happens, eg., to schedule that during off-peak hours (see https://github.com/uyuni-project/uyuni-rfc/pull/5). This RFC is about giving users the possibility to prevent package managers' default behavior of downloading at installation time. | ||
|
||
Package installation and patch application Actions should thus fail in case packages were not previously downloaded (if so configured). | ||
|
||
# Detailed design | ||
- [zypper's execution module installation function](https://github.com/openSUSE/salt/blob/5e0fe08c6afd75a7d65d6ccd6cf6b4b197fb1064/salt/modules/zypperpkg.py#L1207) gets a new commandline option, `cachedonly`, `False` by default | ||
- if `True`, before proceeding with any installation it should call `zypper` with the `--dry-run` option and check if any download is necesary. Commandline example below: | ||
``` | ||
minion:~ # zypper --non-interactive --xmlout install --dry-run zsh | ||
<?xml version='1.0'?> | ||
<stream> | ||
|
||
... | ||
|
||
<install-summary download-size="0" space-usage-diff="7389792" packages-to-change="1"> | ||
|
||
... | ||
</stream> | ||
``` | ||
- if the `install-summary` element's `download-size` attribute is greater than 0, installation should fail with an adequate error | ||
- zypper's execution module should be checked to make sure no "read" methods require network access (eg. `list_patches`) | ||
|
||
- The Server's [package installation](https://github.com/uyuni-project/uyuni/blob/c8ffe6b9425392f5235864ad070646bb8ebc2ecb/susemanager-utils/susemanager-sls/salt/packages/pkginstall.sls) and [patch application](https://github.com/uyuni-project/uyuni/blob/c8ffe6b9425392f5235864ad070646bb8ebc2ecb/susemanager-utils/susemanager-sls/salt/packages/patchinstall.sls) modules should pass the new `cachedonly` parameter to the `pkg` state modules, which will in turn relay it to the execution modules above | ||
|
||
- This should only happen if the minion's `mgr_fail_installation_if_download_is_required` Pillar is set | ||
|
||
- Pillars controlling this feature can be set at a global, per-minion or per System Group basis ([similarly to what we do to set the package download endpoint override](https://github.com/SUSE/doc-susemanager/pull/366/files#diff-8bf787463eb899039a59878b8b2ce800R171)). | ||
|
||
## Extensions | ||
- `yum` and `dnf` can be also easily supported by adding `cachedonly` to the respective `install` methods, and then invoking the commandline tools with the `-C` option. [This is already implemented for "read" functions such as list_repo_pkgs](https://github.com/openSUSE/salt/blob/5e0fe08c6afd75a7d65d6ccd6cf6b4b197fb1064/salt/modules/yumpkg.py#L829) | ||
- `apt` could be supported in a similar way via the `--no-download` commandline option | ||
|
||
# Drawbacks | ||
- this is limited to Salt minions. Traditional clients have no such feature | ||
- this targets only `zypper` at least initially, see Extensions | ||
- no UI | ||
|
||
# Alternatives | ||
- use Action Chains | ||
- pro: more visible to users | ||
- con: could have scalability issues, more difficult to implement | ||
- implement custom modules instead of adding new functions to Salt's core | ||
- pro: does not need a pull request against Salt | ||
- con: the functionality might be useful in other contexts | ||
|
||
# Next steps | ||
|
||
Instead of resorting to two `zypper` calls via `--dry-run`, an option such as `yum`'s '`--cacheonly` or `apt`'s `--no-download` could be added directly in `zypper`. Arguably, that would be cleaner design, although an updated `zypper` would be needed. A feature request against `zypper` will be opened in this sense. | ||
|
||
# Unresolved questions | ||
|
||
None known. | ||
moio marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.