Commit graph

69 commits

Author SHA1 Message Date
Michael DeHaan
5c75ce1133 In apt module show 'name' vs pkg to standardize with the rest of the modules. 'pkg' is an alias for name. 2014-04-29 15:48:51 -04:00
James Cammarata
afee14173e Merge pull request #7095 from radeksimko/pokemon-exc-fix
Prevent catching unrelated exceptions
2014-04-21 11:49:04 -05:00
Radek Simko
1513d2bd64 Prevention for catching unrelated exceptions added 2014-04-21 15:35:49 +01:00
Radek Simko
8bdd96b273 Explicit check of return code for autoinstallation of python-apt added
This will allow easier debugging through more meaningful error message.
2014-04-21 14:10:09 +01:00
Drew Blas
2e26549426 Update apt:deb with correct version
The docs site says this option is available in 1.5, but it is not.  

#5910 https://github.com/ansible/ansible/pull/5910 added the deb option.  The PR was generated two months ago (before 1.5) but was not included until after 1.5 was released.  This fixes the docs.
2014-04-04 05:59:57 -05:00
James Tanner
c751168895 Fix merge conflicts 2014-03-31 13:15:21 -04:00
Michael DeHaan
53d03dc968 Merge branch 't-apt-list' of git://github.com/Elemecca/ansible into devel 2014-03-28 12:19:23 -04:00
Colin Mattson
3e6bf9640c Clarify documentation for apt pkg, state, install_recommends 2014-03-21 13:52:36 -07:00
Jonathan Dray
0981488df7 fix: bug in apt when python-apt is not present apt-get was not called due to unsafe call 2014-03-17 02:24:12 +01:00
Sam Hanes
b384db53f8 Add support for YAML lists to apt module. 2014-03-14 00:22:32 -07:00
Patrick Gerken
38d6956c1f Properly catch import errors in apt
When one accidentally tries to run this module as a user, he gets the error message that python-apt must be installed, no matter what. Because importing apt will trigger an exception as a regular user. Explicitly catching the ImportError will let the exception bubble. The exception clearly says Permission denied somewhere, and the user has a better idea, what he must fix.
2014-03-14 02:13:20 +01:00
Michael DeHaan
297b048d0e Fix other reference to APT_ENV_VARS. 2014-03-11 10:47:53 -04:00
Michael DeHaan
c09d4b1c7a Update apt module so that environment variables are set correctly since not going through shell. Very sorry folks, it will be addressed. 2014-03-11 08:39:28 -04:00
James Cammarata
be0be16e89 Merge branch '5853-python-2.5-apt_repository-fix' of https://github.com/timurbatyrshin/ansible into timurbatyrshin-5853-python-2.5-apt_repository-fix 2014-02-24 15:20:29 -06:00
Lorin Hochstein
4a7c6a9727 apt module: Add support for installing .deb packages
Support installing .deb packages from the local filesystem.

    apt: deb=/tmp/mypackage.deb
2014-02-07 20:45:26 -05:00
Timur Batyrshin
db173453ba further compatibility with older versions of python-apt (#5853) 2014-02-02 23:15:19 +04:00
Rene Moser
849aab0a12 apt: fixed pkg=<name>=<version> fails if package is not yet installed.
Reported and patch provided by https://github.com/msolo. Closes GH-5625.
2014-01-16 11:05:12 +01:00
lichesser
7201972a56 Remove debugging code
I guess this is left over from testing
2014-01-08 02:34:59 +01:00
James Tanner
c8bd14925d Fixes #5369 Do not pass --force-yes to aptitude 2014-01-07 15:53:28 -05:00
jctanner
b9cb49e638 Merge pull request #4872 from timurbatyrshin/4869-old-python-apt-fix
#4869 compatibility with older versions of apt
2013-12-13 10:43:47 -08:00
Rene Moser
2d805ae5da apt: update index before trying to autoinstall python-apt 2013-12-09 10:21:27 +01:00
jctanner
6b45c4a6ca Merge pull request #5181 from mvo5/bugfix/apt-fnmatch-remove
add fnmatch() support for apt remove too (just like install)
2013-12-05 09:18:04 -08:00
Michael Scherer
3df62f1d8a Fix apt module to be able to install package by giving just a provides and not the full name
The apt module check if a packag eis valid by loking in the cache, checking only for
full name, while it should also check that the name is not just provided.
Fix https://github.com/ansible/ansible/issues/5177
2013-12-05 17:56:54 +01:00
Michael Vogt
559de5c65e add fnmatch() support for apt remove too (just like install) 2013-12-05 17:54:43 +01:00
James Tanner
ad837709bd Addresses #5023 Fix import comments 2013-12-02 15:13:49 -05:00
James Tanner
6000d636b3 Fixes #5023 Convert all modules to use new snippet import pattern 2013-12-02 15:11:23 -05:00
Michael DeHaan
36effd237c There's a cleaner way to do this, commit to module formatter pending.
Revert "No longer need to reference 'version_added' in docs for these, as this was quite a while ago."

This reverts commit ff0a41d446.
2013-11-27 21:23:03 -05:00
Michael DeHaan
ff0a41d446 No longer need to reference 'version_added' in docs for these, as this was quite a while ago. 2013-11-27 21:19:32 -05:00
James Tanner
f332bb0d7c Fixes #4891 Catch unicodedecode errors from python-apt 2013-11-13 09:48:56 -05:00
James Tanner
7502e15298 Address #4285 remove redundant stderr output in apt module 2013-11-11 22:27:47 -05:00
jctanner
9faaa2b98b Merge pull request #4285 from blair/apt-module-register-stdout-stderr
apt: pass child process stdout and stdout to m.fail_json() and m.exit_js...
2013-11-11 19:15:10 -08:00
jctanner
a28bcd60d9 Merge pull request #4617 from resmo/feature/python-apt
apt: autoinstall python-apt if apt or apt_pkg is not available
2013-11-11 18:50:43 -08:00
James Tanner
f820e8e719 Merge pull request #4286 from blair/ansible
apt: do not consider not-removed and not-upgraded packages as changes.
2013-11-11 21:39:07 -05:00
Timur Batyrshin
9e7623e9de #4869 compatibility with older versions of apt 2013-11-11 16:56:05 +04:00
Yegor Minin
df5fd0e0d0 apt: allow specifying dpkg options
This will allow specifying dpkg options as a string passed over to apt
command. dpkg_options expects a comma-separated string of options to be
passed as dpkg options which will be further expanded. For example
dpkg_options='force-confdef,force-confold' will end up as
-o \"Dpkg::Options::=--force-confold\" when passed to apt
Example usage would be:
-m apt -u ubuntu -s \
 -a "upgrade=dist update_cache=yes dpkg_options='force-confold'"
or
apt: upgrade=dist update_cache=yes dpkg_options='force-confold'
2013-11-01 20:11:40 +02:00
Rene Moser
a10e017d6e apt: autoinstall python-apt if not available 2013-10-21 16:39:18 +02:00
Michael DeHaan
0e55bd892d For values that are booleans in the module doc, the value in the doc section should be a boolean or truthiness
is engaged in the documentation formatting.  This fixes the update_cache default in the docs to the proper
value of "no"
2013-10-09 07:52:23 -04:00
Michael DeHaan
203a4f10cd Use explicit boolean defaults in apt module to make the code more clear. 2013-10-09 07:47:24 -04:00
Blair Zajac
3a8c9f04da apt: do not consider not-removed and not-upgraded packages as changes.
If one pins a package and does a 'apt-get dist-upgrade' then the
output looks like:

    # apt-get dist-upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages have been kept back:
      cassandra
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

The check for any changes made should only be on the 'upgraded' and
'newly installed' values and not include the 'to remove' and 'not
upgraded' values.
2013-09-28 16:50:50 -07:00
Blair Zajac
d133c0aeee apt: pass child process stdout and stdout to m.fail_json() and m.exit_json().
Without this, this fails:

    - name: apt-get dist-upgrade
      action: apt upgrade=dist
      register: apt_get_contents

    - name: apt-get clean
      action: command apt-get clean
      when: apt_get_contents.stdout.find("0 upgraded") == -1

TASK: [apt-get clean] *********************************************************

fatal: [192.168.2.2] => error while evaluating conditional: {% if apt_get_contents.stdout.find("0 upgraded") == -1 %} True {% else %} False {% endif %}

FATAL: all hosts have already failed -- aborting
2013-09-28 16:28:18 -07:00
James Cammarata
671eeb65b2 Merge pull request #4138 from resmo/fix/redundant-fail-json
apt: fixed duplicate fail_json
2013-09-17 06:08:51 -07:00
Rene Moser
9449d62fb2 apt: fixed duplicate fail_json 2013-09-17 15:05:20 +02:00
James Cammarata
0d408ff295 Use low-level package objects in the apt module to check installed state
Packages which are half-installed are not adequately represented by
the .is_installed field of the apt.package.Package object. By using the
lower-level apt_pkg.Package object (which provides the .current_state
field), we can check for a partially-installed state more accurately.

Fixes #3421
2013-09-11 23:33:59 -05:00
James Cammarata
6feb4e3837 Fail apt package install when nothing is matched by the fnmatch pattern
Related to PR #3823
2013-08-12 11:26:31 -05:00
Michael Vogt
5c39c659e5 add support for fnmatch() style apt filenames
You can write a apt action like "- apt: pkg=apt*" with this package.
2013-08-12 16:11:15 +02:00
Alan Grosskurth
b950f9456a apt: Run remove commands noninteractively
I'm seeing ansible hang when trying to remove a package, and the hung
process is `whiptail` like in #2763. It looks like we only use
`APT_ENVVARS` and `DPKG_OPTIONS` for the `apt` commands in install()
and upgrade(). This change uses them in remove() as well, which fixes
the hang.
2013-08-05 15:20:45 -07:00
Michael DeHaan
a35370a766 Fix prev feature commit, Do not require aptitude to use apt commands in the apt module, only needed when upgrading. 2013-07-22 15:15:55 -04:00
Michael DeHaan
e1167d6977 tweak indentation for 'make pep8' 2013-07-20 12:48:11 -04:00
Michael DeHaan
f4b1e426ea Merge pull request #3379 from serenecloud/devel
Return a friendly error message if aptitude isn't installed
2013-07-19 07:36:39 -07:00
Felix Stuermer
b5df29901f Use the force=yes option for apt upgrade actions 2013-07-09 10:57:19 +02:00