tickets #17702
closedsaltstack: add repos before packages get installed
0%
Description
We need to check if it is possible to tell salt to add repos before it installs packages. If it is not possible, file an upstream ticket
Updated by cboltz over 7 years ago
wild, untested guess: swap the "profile.zypper.packages" and "profile.zypper.repositories" includes in salt/profile/zypper/init.sls
(and ideally first merge my changes to move around that file to avoid merge conflicts later ;-)
I don't know if anything in salt/role/base.sls installs packages, but if so, you should also move the "profile.zypper" include to the first position there.
Updated by tampakrap over 7 years ago
this is not a sufficient solution, packages and repositories might get installed in a formula as well. I want to ensure that salt will call all pkgrepo resources before it calls any pkg resource
Updated by cboltz over 7 years ago
Correct me if I'm wrong, but AFAIK formulas need to be include'd in salt/role/*.sls - and this would mean that making "profile.zypper" the first item in salt/role/base.sls should work.
That said - yes, a formula could add a repo, but a) that would (hopefully) be specific to that formula and get added before installing packages from it and b) I don't like the idea too much to drop in random repos with a formula - there's a reason we have openSUSE:infrastructure + subprojects. (In other words: formulas should not add any repos IMHO.)
Updated by tampakrap over 7 years ago
you are overthinking it. I was just setting up an example to get you understand that pkgrepo needs to be called always before pkg.install. Puppet provides such a mechanism, where it collects all the equivalent pkgrepo resources and calls them before anything else on the system.
Updated by aboe76 over 7 years ago
saltstack-formulas are regarded as single solutions for the service/package/config it should manage.
so if a formula installs a package from a repo, it should do something along the folowing line:
- provide a way to install the repo and refresh it.
- install the package after installing the repo.
or the you can do the following,
- formula to manage all repo's and refresh the repo's after something changes. (first rep in top.sls
- formula to install a pkg always after the formula that manage repos
Saltstack doesn't have the ability to change a module on a global scale, only per sls file.
you can override stuff or extend stuff per sls file.
pkg options:
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed
extend stuff
https://docs.saltstack.com/en/latest/ref/states/extend.html
Hopefully this will help with building formulas
Updated by tampakrap over 6 years ago
- Status changed from New to Closed
closing because it's nothing we can do, and upstream is aware (and not really willing to add the functionality from my understanding)