The current $install_check variable greps for 'Installed' or
'Candidate', which means that it will give the wrong result
when a non-English locale is used. This patch ensures that the
check will work properly for non-English locales by setting the
environment parameters for the exec to LC_ALL=C LANG=C
when updating or installing newer packages with apt::force and you have changed previous
configuration files aptitude or apt-get will prompt what to do. You can suppress that
by pre-define the action with cfg_files parameter (new, old or unchanged and its backward
compatible if not defined). With a second optional parameter cfg_missing you can force
your provider to install missing configuration files as well.
Signed-off-by: Martin Seener <martin@seener.de>
apt::force: Changed selectors used in force.pp to case statements; refs #module-1306
Signed-off-by: Martin Seener <martin@seener.de>
apt::force: rspec: fixed the failing tests and added validate_re for cfg_files and validate_bool for cfg_missing. Also removed default values for both case statements and only allow pre-defined values or true/false. Furthermore enhanced the README refs #module-1306
Was able to fix the failing rspec tests for the patch.
Thanks to Morgan Haskel.
Signed-off-by: Martin Seener <martin@seener.de>
Despite the puppetlabs-stdlib documentation says validation_re supports 3 arguments the tests failed telling that only 2 are supported. Fixed this by removing the 3 optional argument; refs #modules-1306
Signed-off-by: Martin Seener <martin.seener@barzahlen.de>
apt::force: updated readme refs #module-1306
Signed-off-by: Martin Seener <martin@seener.de>
Use release parameter to construct $release_string.
The release parameter may also be set to false to use the system's
default release (so just force a specific version). Use false as the
default setting instead of 'testing'.
Change $install_check to also check if package is installed from the
right release, instead of just checking the version.
With the addition of this patch two new defines will be added; one to
manage APT configuration files (apt::conf) and one that abstracts out the
requirements needed to turn on backport repositories (apt::backports).
In addition, the patch takes the opportunity to clean up variable
definitions so they follow a consistent pattern of setting local
variables to the fully qualified value stored in the apt::params
class. Previously all variable used within a class directly addressed
the apt::params namespace when ever the variable was used. In the
pattern they now adhere to we can more easily switch the namespace
data lives in or externalize it even more using hiera.
Previously, even if $version were passed to apt::force, aptitude would just
install the default version of the package available. This updates the aptitude
call to use the version string if it exists. If no version is passed, or if it
is false, no version is added to the aptitude call. This also updates the
rspec-puppet tests for the define, to reflect the changes to the exec.
This patch fixes the query used by apt::force to
determine rather or not the package is installed.
Previously, the expression was not specific enough and
could not lead to false positives in cases where a package
name is contained within another package name (puppet could be
incorrectly determined as being installed if puppet-common is
installed)
This commit resolves that by improving the query expression.