-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
FreeBSD pkg provider battch support. #29707
FreeBSD pkg provider battch support. #29707
Conversation
When installing packages in FreeBSD thatt have an interactive post-installation BATCH environment variable is used to answer all post install questions. The idea here is to check if that variable is set and in case is True make sure to use it
I'm not sure I follow this. In what case is a value present in the environment but then needs to be re-set to that same vaule? |
HI @cachedout I was assuming that salt in not getting BATCH=yes from environment based on this issue #27056 Thinking this again, I don't see any reason why BATCH=yes is not set inside Salt since running a state that requires manual interaction doesn't sound a good idea. Ping @oogali the original reported. |
@abednarik, __salt__['cmd.run']('pkg install htop', env={'BATCH': 'yes'}) |
Hi @jfindlay thanks for that. I'm still thinking why BATCH=yes is not set by default, since otherwise installing packages with post install script will not work. Cheers. |
@abednarik, no problem. Your help is very much appreciated. |
Update: https://www.freebsd.org/cgi/man.cgi?query=pkg_add&manpath=FreeBSD+7.2-RELEASE pkg_add in FreeBSD doesn't support non interactive mode. |
HI @jfindlay / @cachedout This looks weird for me {this env is not defined in this function and is referenced as a local variable ( function scope ). Maybe that's the reason why env variables are not used when cmd.run is executed? |
@abednarik, that would definitely be a problem. :) |
Thanks. Will check how salt parsers and call that module to see if I can get that variable inside that function. |
Maybe I can bring some light into this. Regarding the env BATCH, this is supported by the old (pkg_...) tools and by pkg. |
HI @ohauer Thanks for bring some light here :) After reading your comment and the original issue, i found a mistake from my side. The issue was reported against pgkng and I was trying to fix this issue in pkd_add.. I will close this one, since nobody reports an issue with this old version. Thanks. |
After digging a bit around this I found out
One last thing looking at pkgng.py is that the argument -y is anly use when dryrun is set to True. See here |
Hope this one #29909 fixes this issue. |
I don't think the general usage of '-y' will fix the issue from #27056 as pkgng does not generate the required BATCH=yes env. I identified four ports using the env BATCH in the install or de-install script since they have to modify files in the base OS (e.g. /etc instead /usr/local/etc or /etc/services) to change base OS settings. |
When installing packages in FreeBSD that have an interactive post-installation BATCH
environment variable is used to answer all post install questions. The idea here is
to check if that variable is set and in case is True make sure to use it
Fixes #27056
I'm sending this against develop because is more or less WIP or a feature for now. I will take of doing a proper PR in case this code is good enough and do what it says.