The documentation for the `state` field is not very clear.
It says possible values are "installed, uninstalled" and default value is "present"
The examples below alow uses `present` and `absent`.
This patch uses "absent" and "present" instead of "installed" and "uninstalled"
Moreover, this is consistent with other packaging modules, like homebrew itself
package_latest was calling package_present but did not care
about the return code so errors in package_present were hidden
and everthing look ok on the console when zypper update did not fail,
but no packages where installed.
* Add support for check mode
* Use "pkgin search" to guarantee 0 or 1 result
* Edit documentation for style, new feature, etc.
* General refactoring
* Lay some groundwork for future support of "state=latest"
Some packages attempt to prompt the user for certain settings during
installation. Thus, this parameter sets the environment variable
$BATCH to 'yes', which forces package installation scripts to accept
default values for these interactive prompts. This should work for all
prompts that have a default value and aren't implemented through a
custom script (as this variable is built into the ports/package system).
FIXME: Package install should fail if it prompts and batch isn't set;
currently, the install hangs indefinitely.
TODO: Allow user to specify the answers to certain prompts.
I (github.com/mwpher) have NOT tested this with any packages besides
bsdstats. It's a small improvement, but not a complete answer to all
the complexities of package installation.
In case of release repositories or other special cases you might not
need the autorefreshing of the repos. This patch adds a configure
option instead of hard enabling this.
Signed-off-by: Justin Lecher <jlec@gentoo.org>
Fix bug in ansible get_package_state and get_current_version that breaks when there are multiple versions of a package installed and there is a list of packages to install.
The previous implementation used 'zip' to match requested names to installed names which fails, because rpm outputs multiple lines per package when there are multiple versions.
Testcase: Install opensuse, install multiple kernel versions (happens by update)
Before patch: calling
zypper: state=present for name={{item}}
with_items:
- kernel-desktop
- git
leads to ansible aborting.
After the patch ansible performs as expected and makes sure both packages are present.
Also the last version number is used for further update information in this version (before if only one package name was given the oldest version number was used).