Commit graph

74 commits

Author SHA1 Message Date
NielsH
ab699a0953 Resolve idempotency issue with virtual apt package (#3449)
Virtual packages were always marked as upgradable which caused the changed-state even though nothing changed.
2016-04-18 11:14:57 -04:00
Tobias Wolf
dba53b5543 Add diff to apt.py (#2944)
for install, remove, deb_install, and upgrade.

Since apt has very commonly familiar output, just use the normal output
from apt-get or aptitude -- trimmed to the interesting parts -- to show
to the user if she specified --diff on the CLI.

Uses the recent support for the `diff['prepared]` key.

Fixes ansible/ansible#10239
2016-04-18 10:18:07 -04:00
Oleg Senin
377e94f77f Correct misspell (#3454) 2016-04-18 13:24:33 +02:00
Hugh Saunders
e9fd7befb7 Retry apt cache updates 2016-03-29 08:35:34 +01:00
René Moser
d4285b5f21 Merge pull request #2613 from Jmainguy/apt_download_deb
Add ability to download deb from url
2016-03-28 23:30:47 +02:00
Rene Moser
e760b45867 apt: doc: fix missing version_added
see #2023
2016-03-23 20:52:14 +01:00
Chris Lamb
f4bc59595c os/apt.py: Add support for passing --allow-unauthenticated
This is useful for packages that bootstrap their own apt-key setup - only
the initial installation will require overriding. Notable examples are the
Dropbox and Google Chrome packages.

(Setting force=yes is far too strong: I only want to bypass
authentication!)

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
2016-03-23 19:55:58 +08:00
Toshio Kuratomi
22a9a15a5b Fix indent in documentation 2016-03-18 09:09:10 -07:00
Roland Sommer
b118c5ef11 honour 'only_upgrade' flag for 'build_dep' case in 'apt' module 2016-03-17 11:22:07 +01:00
Roland Sommer
bc9fb43ac0 add 'only_upgrade' switch to apt module 2016-03-11 16:12:14 +01:00
Matt Martz
d112599fd5 Set version_added to 2.1 for autoremove. Fixes #3200 2016-03-08 07:31:22 -06:00
Matt Davis
7d2fd4e944 Merge pull request #2926 from mattclay/apt-unsafe
Split shell command to avoid use_unsafe_shell.
2016-03-08 04:56:51 +00:00
Brian Coca
38d6c1cd36 expanded info on fail on check + missing apt-python
it now explains that apt module will auto install
2016-02-11 01:22:21 -05:00
Matt Clay
d33e033eba Do not install python-apt in check mode. 2016-02-10 20:39:52 -08:00
Toshio Kuratomi
1df8ebf0c3 use new method of setting locale and other environment variables
The old method left settings in the environment.  The new method takes
care of clearing them after use.  In this module, the old method was
also setting the environment too late to affect all the command line
tools which lead to a bug.

Fixes https://github.com/ansible/ansible/issues/14264
2016-02-07 14:17:36 -08:00
Charles Paul
d7a0a3b7e3 adding autoremove to apt 2016-02-05 12:42:25 -06:00
Matt Clay
e56d668ade Split shell command to avoid use_unsafe_shell.
This mirrors a nearly identical change made to apt_repository.py.

Also removes the use of apt-get --force-yes as it can be dangerous
and should not be necessary (apt_repository.py does not use it).

Repeating the explanation from the apt_respository change below:

Since use_unsafe_shell is suspicious from a security point
of view (or it wouldn't be unsafe), the less we have, the less
code we have to thoroughly inspect for a security audit.

In this case, the '&&' can be replaced by doing 2 calls to run_command.
2016-01-31 02:22:59 -08:00
Arata Notsu
14950824c3 apt: export env vars before run dpkg
Without this change, some trouble may occur when "deb" parameter
is used as env vars controlling dpkg are not set. For example,
installing a package that requires user input will never end since
DEBIAN_FRONTEND=noninteractive is not set.

So export env vars in APT_ENV_VARS before run dpkg, like in cases
using apt-get/aptitude.
2016-01-06 12:11:53 +09:00
Jonathan Mainguy
b0db35a369 Add ability to download deb from url
if :// in deb, will try to download from url.
2015-12-02 23:24:23 -05:00
Charles Ferguson
fca36415d6 Update the documentation of the 'apt' action for the 'name'.
The package name has two aliases, 'package' and 'pkg'. Add them to the
documentation.
2015-11-24 15:55:31 +00:00
Toshio Kuratomi
5cacef8617 Fixes for bcoca's review of #1916 2015-11-02 13:04:12 -08:00
Harlan Lieberman-Berg
a53cf5434b Give include_recommends a useless default to make the parser happy. 2015-11-02 13:04:12 -08:00
Harlan Lieberman-Berg
06a4efa1cf Add missing brace. 2015-11-02 13:04:12 -08:00
Harlan Lieberman-Berg
a234e9b7b2 Change install_recommended in apt to a trinary.
Conditions are now "yes", "no", and "default", with the latter falling
back to the OS default.
2015-11-02 13:04:12 -08:00
Harlan Lieberman-Berg
baafcfc091 Change behavior of apt.py around installing recommended packages.
Closes #1189.

This will cause the settings in Ansible to override the system settings.
That will have no effect except on systems that have an out-of-Ansible
configuration that disables automatic installation of recommended
packages.  Previously, ansible would use the OS default whenever
install_recommends wasn't part of the playbook.  This change will cause
the Ansible default configuration setting of installing recommended
packages to override the configuration files set on the OS for things
installed through ansible, even when there is no install_recommends
specified in the playbook.  Because the OS default matches the Ansible
default, this shouldn't have wide impact.
2015-11-02 13:04:12 -08:00
Patrick Galbraith
2a93f21821 Fix to issue 12912. Supply 'force' to install of python-apt. 2015-10-26 13:28:10 -04:00
Marius Gedminas
eb17b6a36c apt: check for "0 upgraded" to be at the beginning of the line
Fixes #1678.
2015-08-25 19:15:33 +03:00
Brian Coca
5913f5e5e1 deal with more failures when apt module fails to instantiate pkg
fixes #1499
2015-08-18 14:59:35 -04:00
Brian Coca
93754b903f updated upgrade to a more sensible default as the previous was prone to confusion
fixes #1667
2015-07-03 14:44:17 -04:00
Matt Martz
9eb4219f79 Replaced tabbed indentation with spaces for apt module 2015-07-01 09:39:18 -05:00
Greg DeKoenigsberg
2a5f0bde87 Proper author info for all remaining modules 2015-06-15 15:53:30 -04:00
Brian Coca
6d088169ef Merge pull request #1348 from devjatkin/issue_1230
fix apt to handle virtual packages correctly
2015-05-26 11:55:44 -04:00
Brian Coca
0d41af23c2 Merge pull request #909 from bcoca/apt_return_cacheinfo
added updated cache time to apt, also started documenting return values
2015-05-26 11:54:03 -04:00
Semyon Deviatkin
adf34a6ccd Fix issue #1230
When virtual package providing only one package, look up status of target package
2015-05-18 08:10:22 +00:00
Toshio Kuratomi
7540cbb845 Explain why the apt module does not do implicit regex matches on package name since this is different than the apt-get command line tool.
Fixes #1258
2015-05-07 08:16:46 -07:00
bugchecker
496f9ca180 prevent using undefined variable 2015-04-05 20:40:11 +05:00
Tim Rupp
dba0023940 Add missing import of apt.debfile
In cases when the python-apt package is not installed, ansible will
attempt to install it. After this attempt, it tries to import the
needed apt modules, but forgets to import the apt.debfile module.

The result is that playbooks that use the dpkg argument on a machine
that does not initially have the python-apt package available will
fail with the following error

AttributeError: 'module' object has no attribute 'debfile'

This patch adds the appropriate import to the apt module to ensure
that necessary libraries are available in cases when the dpkg argument
is being used on a system that does not initially have the python-apt
package installed
2015-03-19 14:54:59 -07:00
Brian Coca
19ec770680 added updated cache time to apt, also started documenting return values 2015-03-08 11:47:35 -04:00
Brian Coca
2fcc93e5b3 Merge pull request #785 from bcoca/apt_deb_missing
now module fails gracefully instead of stacktrace
2015-02-25 10:38:29 -05:00
Brian Coca
818767b1d4 Merge pull request #53 from hfinucane/apt-dpkg-force
dpkg does not take a --force-yes option
2015-02-16 18:51:55 -05:00
Brian Coca
611e8b59d6 now module fails gracefully instead of stacktrace when trying to install missing deb file 2015-02-13 11:06:06 -05:00
Conrado Buhrer
bd208da8ea fixed: namespace clash #710 2015-01-27 13:28:56 -02:00
Conrado Buhrer
a5114bfa39 fixed: erroneous logic 2015-01-26 18:16:42 -02:00
Conrado Buhrer
3155656eef fixed: missing check for upgrade flag 2015-01-26 17:48:03 -02:00
Conrado Buhrer
ef3f486f6e fixed: removed build-deb from required_one_of 2015-01-26 17:32:34 -02:00
Conrado Buhrer
711005fe9b changed: state=build-dep; refactored into install() 2015-01-26 15:36:35 -02:00
Conrado Buhrer
d257e2be8c added: build-dep to apt module #349
Original code provided by @nathanhruby
2015-01-26 13:20:00 -02:00
Brian Coca
e2dcb5fc9b now captures cache fetch failures 2015-01-14 17:29:00 -05:00
fabios
9ed842e2d0 mark as upgradable and let apt-get install deal with it 2014-12-28 12:52:57 -05:00
fabios
b747d9411a improve fail message and use itertools chain 2014-12-28 12:52:57 -05:00