Commit Graph

56 Commits (c09d4b1c7a8494f961ae9e071f89c95a4a944002)

Author SHA1 Message Date
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. 11 years ago
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 11 years ago
Timur Batyrshin db173453ba further compatibility with older versions of python-apt (#5853) 11 years ago
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.
11 years ago
lichesser 7201972a56 Remove debugging code
I guess this is left over from testing
11 years ago
James Tanner c8bd14925d Fixes #5369 Do not pass --force-yes to aptitude 11 years ago
jctanner b9cb49e638 Merge pull request #4872 from timurbatyrshin/4869-old-python-apt-fix
#4869 compatibility with older versions of apt
11 years ago
Rene Moser 2d805ae5da apt: update index before trying to autoinstall python-apt 11 years ago
jctanner 6b45c4a6ca Merge pull request #5181 from mvo5/bugfix/apt-fnmatch-remove
add fnmatch() support for apt remove too (just like install)
11 years ago
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
11 years ago
Michael Vogt 559de5c65e add fnmatch() support for apt remove too (just like install) 11 years ago
James Tanner ad837709bd Addresses #5023 Fix import comments 11 years ago
James Tanner 6000d636b3 Fixes #5023 Convert all modules to use new snippet import pattern 11 years ago
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.
11 years ago
Michael DeHaan ff0a41d446 No longer need to reference 'version_added' in docs for these, as this was quite a while ago. 11 years ago
James Tanner f332bb0d7c Fixes #4891 Catch unicodedecode errors from python-apt 11 years ago
James Tanner 7502e15298 Address #4285 remove redundant stderr output in apt module 11 years ago
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...
11 years ago
jctanner a28bcd60d9 Merge pull request #4617 from resmo/feature/python-apt
apt: autoinstall python-apt if apt or apt_pkg is not available
11 years ago
James Tanner f820e8e719 Merge pull request #4286 from blair/ansible
apt: do not consider not-removed and not-upgraded packages as changes.
11 years ago
Timur Batyrshin 9e7623e9de #4869 compatibility with older versions of apt 11 years ago
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'
11 years ago
Rene Moser a10e017d6e apt: autoinstall python-apt if not available 11 years ago
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"
11 years ago
Michael DeHaan 203a4f10cd Use explicit boolean defaults in apt module to make the code more clear. 11 years ago
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.
11 years ago
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
11 years ago
James Cammarata 671eeb65b2 Merge pull request #4138 from resmo/fix/redundant-fail-json
apt: fixed duplicate fail_json
11 years ago
Rene Moser 9449d62fb2 apt: fixed duplicate fail_json 11 years ago
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
11 years ago
James Cammarata 6feb4e3837 Fail apt package install when nothing is matched by the fnmatch pattern
Related to PR #3823
11 years ago
Michael Vogt 5c39c659e5 add support for fnmatch() style apt filenames
You can write a apt action like "- apt: pkg=apt*" with this package.
11 years ago
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.
11 years ago
Michael DeHaan a35370a766 Fix prev feature commit, Do not require aptitude to use apt commands in the apt module, only needed when upgrading. 11 years ago
Michael DeHaan e1167d6977 tweak indentation for 'make pep8' 11 years ago
Michael DeHaan f4b1e426ea Merge pull request #3379 from serenecloud/devel
Return a friendly error message if aptitude isn't installed
11 years ago
Felix Stuermer b5df29901f Use the force=yes option for apt upgrade actions 11 years ago
serenecloud a17ca862fb Return a friendly error message if aptitude isn't installed 11 years ago
Michael DeHaan 50fa88f28a Merge branch 'fix-apt-purge' of git://github.com/madduck/ansible into purge 11 years ago
Michael DeHaan d9c0a5c37d Revert "now modules can implement with_items list globbing w/o updating"
This reverts commit 4942a06bc2.

Conflicts:

	lib/ansible/runner/__init__.py
11 years ago
martin f. krafft ae42144752 Always assume purged for older python-apt
Older python-apt modules don't export Package.installed_files and there
seems to be no other way to figure out if a package is
removed-but-not-purged, so we just always assume it's purged.

Signed-off-by: martin f. krafft <madduck@madduck.net>
11 years ago
martin f. krafft 420f7d7ac6 Introduce non-purged package status
A package may be removed but not purged with APT. The only way to
identify this state is by looking at the list of installed files of
a package. Even if the package has no files installed, this list will be
non-empty until the package is removed:

  # python -c "import apt; c=apt.Cache(); c.update(); c.open(); p=c['ruby1.8']; print p, p.installed, p.installed_files"
  <Package: name:'ruby1.8' id:1425> None [u'']

  # dpkg --purge ruby1.8
  (Reading database ... 27904 files and directories currently installed.)
  Removing ruby1.8 ...
  Purging configuration files for ruby1.8 ...

  # python -c "import apt; c=apt.Cache(); c.update(); c.open(); p=c['ruby1.8']; print p, p.installed, p.installed_files"
  <Package: name:'ruby1.8' id:1425> None []

See http://bugs.debian.org/712749 too.

If a package is not marked installed but it still 'has_files', then it
should be processed if the request is to purge it.

Signed-off-by: martin f. krafft <madduck@madduck.net>
11 years ago
martin f. krafft 8e37a2bec9 Fix purging of packages
A small error in the reuse of a variable caused packages to never get
purged. This commit fixes that.

Signed-off-by: martin f. krafft <madduck@madduck.net>
11 years ago
Jesse Keating 86bc2ec08a pkg option of apt is not required
You can use apt module with update_cache and without specifying a
package. Update the docs to reflect this.
11 years ago
Michael DeHaan d9f91be34a Merge pull request #3227 from bcoca/modules_wantlist
implementing with_items list globbing made easier for modules
11 years ago
Brian Coca 4942a06bc2 now modules can implement with_items list globbing w/o updating
hardcoded lists in ansible code, just add WITH_ITEMS_USES_LIST in a
comment anywhere, and of course, support recieving params as list.

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
11 years ago
Jan-Piet Mens 5c69918d53 DOCS: standardize on EXAMPLES (a.k.a. Docs-JumboPatch JetLag Edition)
Migrated all examples: in DOCUMENTATION=''' string to standalone EXAMPLES=''' string
  Added deprecation warning to moduledev.rst and remove deprecated example from it
  Fixed up a few typos and uppercased some acronyms.
  add consistency to how EXAMPLES are formatted
11 years ago
John Jarvis 423fe82d94 fixing syntax error 12 years ago
Michael DeHaan 5f98c6c246 Merge pull request #2948 from jcbagneris/devel
Fixes in apt module doc: typos, examples
12 years ago
Michael DeHaan 223e4e2349 Merge pull request #2932 from bcoca/apt_getbins
apt now uses module function to find bin paths
12 years ago