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

package_ensure does not safely ensure a package is installed #172

Open
benjmin-r opened this issue Mar 19, 2014 · 5 comments
Open

package_ensure does not safely ensure a package is installed #172

benjmin-r opened this issue Mar 19, 2014 · 5 comments

Comments

@benjmin-r
Copy link

Hi,

I have a pretty bare Ubuntu 12.04 system (actually a hashicorp/precise64 Vagrant box) in which package_ensure('git') reports deinstall ok config-files OK, or rather the following as full output.

10.0.0.100] run: dpkg-query -W -f='${Status} ' git && echo OK;true
[10.0.0.100] out: deinstall ok config-files OK

According to the man dpkg(1), the config-files state means the package is not installed but config files are present.

So I was wondering if it'd make sense to expand the test for not-installed in package_ensure_apt to test for more states or at least report that packages are not installed, but will still not be installed by cuisine and manual intervention (or whatever) is needed.

I can come up with a PR, but would like your opinion on the semantics of package_ensure.

Thanks for your time!

@sebastien
Copy link
Owner

Hi Benjamin,

Good catch! I can't remember exactly why we tested for not "OK" or "not-installed" instead of just "not-installed". If there's another way for dpkg to say whether a package is installed or not, we should probably switch to that. A PR would be very welcome, thanks!

@benjmin-r
Copy link
Author

Hi Sebastien,

thanks for your quick feedback!
So just to be sure, package_ensure should behave in a way, that if a package is not fully present and installed, as in my case above, then an install should be triggered.
In case of dpkg I'd then actually rather test for not 'installed' (slight difference to what you wrote), as this would cover all the not-installed/semi-broken states that dpkg reports. What do you think?

Thanks!

@sebastien
Copy link
Owner

Yes, if the package is not fully installed, it should be (re)installed. But the tricky is to make sure find the proper command arguments for dpkg and make sure it work in all the possible situations, including having a non-C (or en) locale (which my change the text to non installé for example with a fr LOCALE).

@benjmin-r
Copy link
Author

I don't think I can make the time in near future to come up with a PR. As you described it's a bit more complicated than just testing for one other value.
Feel free to close the issue or leave it open as a reminder.
Thanks for taking the time to answer my questions.

@zodman
Copy link

zodman commented Aug 25, 2014

same error here!

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

No branches or pull requests

3 participants