Commit Graph

627 Commits (e9c2695ce745cf42d1c69166d838ad17555d8b99)

Author SHA1 Message Date
Toshio Kuratomi 2c378cc78a Fix for state=latest with wildcard or virtual provide package names 2016-12-08 11:23:40 -05:00
Brian Coca 2d7b1bd1c4 added comment explaining chdir defaults 2016-12-08 11:23:39 -05:00
Brian Coca d34f89a6fe default chdir to tmpdir to avoid virtualenv issues 2016-12-08 11:23:39 -05:00
Brian Coca 68e7945767 make chdir a path so it resolves shell aliases also removed this_dir logic as it is not needed, chdir is None by default and run_command can handle that. 2016-12-08 11:23:39 -05:00
Brian Coca d55ba3ab7c removed syslog in favor of common module logging functions 2016-12-08 11:23:38 -05:00
Greg DeKoenigsberg c2cc7f17a3 Change author field for os_redhat_subscription.py 2016-12-08 11:23:37 -05:00
Marius Gedminas 270c2e8bbd apt: check for "0 upgraded" to be at the beginning of the line
Fixes #1678.
2016-12-08 11:23:33 -05:00
Toshio Kuratomi 1102afed43 Fix for the case where plugins aren't loaded on old RHEL systems 2016-12-08 11:23:32 -05:00
Toshio Kuratomi 77457feda6 Return change results in a dictionary listing the package names.
Fix a parsing problem when package names contain a dot.
2016-12-08 11:23:32 -05:00
Brian Coca 9ad712018c deal with more failures when apt module fails to instantiate pkg fixes #1499 2016-12-08 11:23:32 -05:00
Jason DeTiberus 3619630972 python 2.4 syntax fix 2016-12-08 11:23:31 -05:00
Jason DeTiberus 8bc90c6a62 Add example for changing consumed subscriptions 2016-12-08 11:23:31 -05:00
Brian Coca c341df2231 updated docs for package 2016-12-08 11:23:30 -05:00
Brian Coca a8b24699be added gpg2 as fallback fixes #1796 2016-12-08 11:23:30 -05:00
queridiculo 92615669c0 yum: improved check_mode handling and package update flow. 2016-12-08 11:23:29 -05:00
Austin Brown 9ffde6c048 Adding version detection 2016-12-08 11:23:29 -05:00
Jason DeTiberus c2bc5a20fa bugfixes for redhat_subscription
- correctly return pool ids for newer versions of subscription-manager
- allow for managing subscriptions after initial registration.
2016-12-08 11:23:28 -05:00
Pierre-Louis Bonicoli fd88e8af53 fix error occurring with Debian
Error was: AttributeError: 'SourcesList' object has no attribute 'repos_urls'
2016-12-08 11:23:27 -05:00
Abhijit Menon-Sen 9b496818cf Simplify distribution test
If it's Ubuntu, use UbuntuSourcesList; if it's any other apt-friendly
distribution, use SourcesList; otherwise, fail.
2016-12-08 11:23:27 -05:00
Abhijit Menon-Sen ca50b5c5e0 Make SourcesList __init__ method also set self.module
This was originally required to allow other methods in SourcesList to
fail, but subsequent changes rendered that unnecessary, and it's just
a cleanup now, and avoids passing in module separately to save().
2016-12-08 11:23:27 -05:00
Abhijit Menon-Sen 46c015375d Clarify HAVE_PYTHON_APT/install_python_apt handling in apt_repository
1. Don't test check_mode in both the caller and in the callee.
2. Don't test HAVE_PYTHON_APT inside an if that tests HAVE_PYTHON_APT
3. Don't be irritatingly vague about why the module fails ("You may be
   seeing this because…").

Note that if «apt-get -y install python-apt» succeeds with rc==0, but
for some reason python_apt is not usable afterwards, this will break
because the imports in install_python_apt aren't wrapped inside a
try/except.

In other words, we assume that install_python_apt either succeeds or
fails with a traceback. This commit doesn't affect that behaviour.
2016-12-08 11:23:27 -05:00
Abhijit Menon-Sen 7643d3aecf Fix call to _expand_ppa 2016-12-08 11:23:27 -05:00
Yuhui Huang 621b396bd9 Checking pip uninstall output in both stdout and stderr 2016-12-08 11:23:24 -05:00
Brian Coca 723a48ca73 added versionadded to new option in pip module 2016-12-08 11:23:23 -05:00
Wouter Bolsterlee 3d7e3e3c3d Add a virtualenv_python argument to the pip module
This allows specifying the Python version to use when creating the
virtualenv. See issue #586.
2016-12-08 11:23:23 -05:00
Wouter Bolsterlee 5a0157a4f2 A few coding style cleanups 2016-12-08 11:23:22 -05:00
Wouter Bolsterlee e8a0b8b8ae Fix typo in `version_added` field. 2016-12-08 11:23:22 -05:00
Brian Coca 6980503357 updated to add missing 'use' option 2016-12-08 11:23:22 -05:00
Toshio Kuratomi 05be82183f Add notes about loop squashing and 1.9.2 change to install packages in one yum transaction 2016-12-08 11:23:19 -05:00
Brian Coca e7dc05df11 updated upgrade to a more sensible default as the previous was prone to confusion fixes #1667 2016-12-08 11:23:17 -05:00
Matt Martz a0f5ae8726 Replaced tabbed indentation with spaces for apt module 2016-12-08 11:23:16 -05:00
Toshio Kuratomi 432764b703 Add version that the profilename param was added 2016-12-08 11:23:16 -05:00
verm666 9b3aa0a9d4 This change is in response to issue #133.
The original problem is: apt_repository.py connect to launchpad on
every playbook run. In this patch apt_repository.py checks if required
repository already exists or not. If no - paa will be added, if yes -
just skip actions.
2016-12-08 11:23:14 -05:00
Toshio Kuratomi 9ecd06fb47 Fix apt_repository so that it does not modify the mode of existing repositories 2016-12-08 11:23:12 -05:00
Sebastian Gerhards a979417a4a rhn_register: add support for profilename 2016-12-08 11:23:12 -05:00
Jim Patterson 4185ffc43e Correct check mode for pip in virtualenv.
Fix #412.  Check mode was always returning changed=True for pip
when the target was in a virtualenv.  The code now uses the normal
tests for determining if change status.
2016-12-08 11:23:11 -05:00
Pierre-Louis Bonicoli c366e7acb2 apt_repository: fix file mode
'set_mode_if_different' method should be called on dest filename and after
'atomic_move' method
2016-12-08 11:23:11 -05:00
Toshio Kuratomi bd87c11c2a Read the url in in chunks so that we don't use as much memory for large packages 2016-12-08 11:23:11 -05:00
Toshio Kuratomi 2e7dcf3317 Small cleanups. * Import url(lib|parse|lib2) if needed by the module rather than relying on module_utils.urls to do so. * Remove stdlib modules from requirements * Use the if __name__ conditional for invoking main() 2016-12-08 11:23:11 -05:00
Toshio Kuratomi 88ae201b20 Fix bugs found by @kustodian 2016-12-08 11:23:09 -05:00
Toshio Kuratomi f0f1dc985f Fix incorrect line breaking 2016-12-08 11:23:09 -05:00
Toshio Kuratomi 9f043d9ba8 Further optimizations pointed out by @kustodian in #1516
* Only install yum-utils if needed (b/c we're going to use repoquery)
* Add a warning message explaining that why slower repoquery was used
  rather than yum API.
2016-12-08 11:23:08 -05:00
Toshio Kuratomi ba566501a8 Yum API is faster than calling out to repoquery. Looking through the commit logs it looks like we weren't previously doing that because of commit 14479e6adc
The message there is that Yum API prints an error message if the
rhn-plugin is in use and no rhn-certificate is available.  So instead of
using repoquery in preference always here we use repoquery in preference
if the rhn-plugin is enabled.
2016-12-08 11:23:08 -05:00
az7arul 5ffb677b00 add `include_doc` option 2016-12-08 11:23:08 -05:00
Toshio Kuratomi ada424078b Restore setting cachedir when non-root but don't take a useless cachedir parameter to the function
* Revert "Remove unused code"
  This reverts commit bcfba0c05098696b6e770335870a9c22792fec38.
* Re-add the changes to remove cachedir as a parameter
2016-12-08 11:23:08 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Edward Torbett 3a4d8f22a6 Renamed previous pkgs variable to installed_pkgs as spotted by @strahinja 2016-12-08 11:23:06 -05:00
Edward Torbett dad26d70fa Corrected pkg to pkgs as noted by @abadger 2016-12-08 11:23:06 -05:00
Edward Torbett 9707a5a95e Added multi package operation to remove as suggested by @abadger. Adding to latest is a little more complex due to '*' support. 2016-12-08 11:23:06 -05:00
Edward Torbett 32180c3c0e Comments by @abadger 2016-12-08 11:23:06 -05:00
Edward Torbett 4b3fff108d Rather than executing yum once per package, execute yum once for all supplied packages. This is necessary when performing a yum upgrade involving multiple dependent packages installed from RPM, for example when upgrading from PostgreSQL 9.0.11 to 9.0.21 on a Red Hat server. 2016-12-08 11:23:06 -05:00
Brian Coca 61054921cf updated package examples 2016-12-08 11:23:05 -05:00
Brian Coca d4d362b475 corrected copyright ... does a copied the copyrightnotice require copyright? 2016-12-08 11:23:05 -05:00
Brian Coca 0f30122750 may root help us all 2016-12-08 11:23:05 -05:00
Demian Gemperli 1c5cb83ff3 Allow to add build flags for gem installation 2016-12-08 11:23:04 -05:00
Toshio Kuratomi 8976b46888 Import ansible module_utils at bottom of file to not mess with line numbers in tracebacks 2016-12-08 11:23:02 -05:00
Jonathan Mainguy a3f30540ca add :// url support for EL 5 2016-12-08 11:23:02 -05:00
Vasyl Kaigorodov 70235a930b Fix "_is_package_installed() takes exactly 4 arguments, 3 provided" error 2016-12-08 11:23:01 -05:00
Schlueter b3be960d24 Add 'version_added' to state documentation for easy_install resource 2016-12-08 11:23:01 -05:00
Schlueter 9e8ce34031 Correct reference to gem in easy_install resource 2016-12-08 11:23:01 -05:00
Schlueter 58863d3b48 Add Documentation 2016-12-08 11:23:01 -05:00
Schlueter 1fc687b19d Use standard if statement to check state in easy_install resource 2016-12-08 11:23:00 -05:00
Schlueter 1ddf4c2368 Correct pass by object reference issue 2016-12-08 11:23:00 -05:00
Zoltan Kozma 1a6b273a4f - Fixed annoying bug that disablerepo was essentially broken if a package needed updating by state latest. - Replaced some unsafe practice with default parameters. However looking at the code this does not seem to matter much as the calling functions always seem to supply these parameters anyway. 2016-12-08 11:23:00 -05:00
Schlueter e198884280 Add state to easy_install 2016-12-08 11:23:00 -05:00
Semyon Deviatkin 732b26ab23 Fix issue #1230
When virtual package providing only one package, look up status of target package
2016-12-08 11:23:00 -05:00
Brian Coca 831e1d8739 added updated cache time to apt, also started documenting return values 2016-12-08 11:22:58 -05:00
Matt Martz 65508bb21a Python2.4 fixes
* Ignore accelerate.py
* Don't use a lambda or a ternary
2016-12-08 11:22:58 -05:00
Toshio Kuratomi dd02483b26 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
2016-12-08 11:22:58 -05:00
Dominic Hargreaves 535f0e9b11 apt_key documentation: add a note explaining the benefit of including 'id' 2016-12-08 11:22:58 -05:00
Jonathan Mainguy f662a48de7 Adds the exclude= option to the yum module. Works the same way --exclude does when yum install or yum update 2016-12-08 11:22:57 -05:00
Toshio Kuratomi 9133ae8c55 Allow yum module to take a yaml list of package names and also ", " separated string-list (in addition to comma separated string-list) 2016-12-08 11:22:55 -05:00
James Cammarata 5a0a9d9f72 Add version_added string to new org_id param in rhn_subscription 2016-12-08 11:22:54 -05:00
bugchecker b7b6367ad5 prevent using undefined variable 2016-12-08 11:22:54 -05:00
Brian Coca b6e3ddba9a ifxed error message as code remove the repo r var 2016-12-08 11:22:54 -05:00
David Wittman be0d28a4ac Set disabled repos before enabled repos
The ordering of disabling/enabling yum repositories matters, and
the yum module was mixing and matching the order. Specifically,
when yum-utils isn't installed, the codepath which uses the yum
python module was incorrectly ordering enabling and disabling.

The preferred order is to disable repositories and then enable them
to prevent clobbering. This was previously discussed in
ansible/ansible#5255 and incompletely addressed in 0cca4a3.
2016-12-08 11:22:53 -05:00
Niels de Vos ca9fd7e136 redhat_subscription: add the `org_id` parameter
When subscribing a system with an activationkey, it seems (sometimes?)
required to pass the "--org <number>" parameter to subscription-manager.
Activation Keys can be created through the Red Hat Customer Portal, and
a subscription can be attached to those. This makes is easy to register
systems without passing username/passwords around.

The organisation ID can be retrieved by executing the following command
on a registered system (*not* the account number):

  # subscription-manager identity

URL: https://access.redhat.com/management/activation_keys
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Ken Dreyer <kdreyer@redhat.com>
2016-12-08 11:22:53 -05:00
Michael Scherer 1559bccdb3 Remove unused option in the repoquery call
Citing the man page:
       -q, --query
              For rpmquery compatibility, doesn't do anything.
2016-12-08 11:22:53 -05:00
Ken Dreyer 46372842e8 redhat_subscription: fix activationkeys argument
Prior to this commit, Ansible would pass '--activationkeys <value>' as a
literal string, which the remote server would interpret as a single
argument to subscription-manager.

This led to the following failure message when using an activation key:

  subscription-manager: error: no such option: --activationkey "mykey"

Update the arguments so that the remote server will properly interpret
them as two separate values.
2016-12-08 11:22:53 -05:00
Florian Apolloner f07096bfe5 Added os.path.expanduser when searching for pip executable. 2016-12-08 11:22:51 -05:00
Tim Rupp db6c2bac75 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
2016-12-08 11:22:50 -05:00
Dann Bohn 2cbaf16bcd rhn_channel using depriciated methods. swapped out with their replacements 2016-12-08 11:22:45 -05:00
Brian Coca 4124f8c381 now module fails gracefully instead of stacktrace when trying to install missing deb file 2016-12-08 11:22:44 -05:00
Henry Finucane 464c502f95 dpkg does not take a --force-yes option 2016-12-08 11:22:42 -05:00
giovtorres 1f034a6573 Added pip example installing from local tarball 2016-12-08 11:22:41 -05:00
AlejandroF 2e40773034 Example added
How to define specific version of the package we need...
2016-12-08 11:22:40 -05:00
Conrado Buhrer 09082e6e7f fixed: namespace clash #710 2016-12-08 11:22:40 -05:00
Conrado Buhrer abde33c615 fixed: erroneous logic 2016-12-08 11:22:40 -05:00
Conrado Buhrer a6315043ef fixed: missing check for upgrade flag 2016-12-08 11:22:40 -05:00
Conrado Buhrer 807b168590 fixed: removed build-deb from required_one_of 2016-12-08 11:22:40 -05:00
Conrado Buhrer 3165b39d21 changed: state=build-dep; refactored into install() 2016-12-08 11:22:39 -05:00
Conrado Buhrer 442663a13a added: build-dep to apt module #349
Original code provided by @nathanhruby
2016-12-08 11:22:39 -05:00
Toshio Kuratomi 52bcf4a195 Don't fial if virtualenv is not installed and we do not need to initialize the virtualenv
Fixes #688
2016-12-08 11:22:39 -05:00
Brian Coca 65d3b167e6 now captures cache fetch failures 2016-12-08 11:22:38 -05:00
Michael Scherer b154bf967e Remove unused code
There is no call to yum_base using 'cachedir' argument, so
while it work fine from a cursory look, that's useless code,
and so should be removed to clarify the code.
2016-12-08 11:22:37 -05:00
Michael Scherer 2dfc7122af Use the rpm python module rather than execing rpm
Using the rpm module prevent a uneeded fork, and permit
to skip the signature checking which slow down a bit the
operation, and which would be done by yum on installation
anyway.
2016-12-08 11:22:37 -05:00
Jonathan Mainguy 6be46cb2e3 Fixes --enable-repo for Oracle Linux 2016-12-08 11:22:35 -05:00
fabios 3c53b3b268 mark as upgradable and let apt-get install deal with it 2016-12-08 11:22:35 -05:00
fabios 043242df2c improve fail message and use itertools chain 2016-12-08 11:22:35 -05:00
fabios 21bfa80203 older python-apt compatibility 2016-12-08 11:22:35 -05:00
fabios 301c8b8e09 handle list of list for python-apt < 0.7.9 compatibility 2016-12-08 11:22:35 -05:00
Toshio Kuratomi 1dc2ae0aef Cleanup the old apt compatibility changes 2016-12-08 11:22:35 -05:00
fabios 0ad355585a use low-level apt_pkg.Package 2016-12-08 11:22:35 -05:00
FabioBatSilva a748229f3a fix compatibility issues with python-apt < 0.7.9 2016-12-08 11:22:34 -05:00
Dale Bewley 65d8fbd9ab use state parameter in examples 2016-12-08 11:22:31 -05:00
René Moser ceeeea84cd yum: add update_cache option
Yum does not always update to latest package version unless metadata cache has expired. By runing yum makecache, we ensure the metadata cache has been updated.

Signed-off-by: René Moser <mail@renemoser.net>
2016-12-08 11:22:29 -05:00
Toshio Kuratomi 1af6a85492 Correct variable name 2016-12-08 11:22:27 -05:00
Henry Finucane 2363074dd8 If force=true, ignore python-apt's advice
This lets you downgrade packages, for instance.
2016-12-08 11:22:27 -05:00
Toshio Kuratomi 81978cbacb Fix retrieval of package version in apt module 2016-12-08 11:22:27 -05:00
Toshio Kuratomi 83e43415da Documentation update for apt version wildcards from bryanlarsen 2016-12-08 11:22:27 -05:00
Toshio Kuratomi 615b954cd8 Update package_status and install to account for wildcarded versions. 2016-12-08 11:22:27 -05:00
Toshio Kuratomi 1ca1b80fe8 Decide to allow pkgname and version wildcards so that things like libxml2*=2.9* would work 2016-12-08 11:22:27 -05:00
Toshio Kuratomi 37fa22eb93 Cache pkg name list so we don't recreate the list for every package 2016-12-08 11:22:26 -05:00
Toshio Kuratomi 6b776da7bc Just make things a little more readable 2016-12-08 11:22:26 -05:00
Toshio Kuratomi 945447e392 if __name__ does work with ansible modules 2016-12-08 11:22:26 -05:00
Michael Vogt e360582c4a add apt unittest 2016-12-08 11:22:26 -05:00
Michael Vogt 80d520dde8 Allow foo=1.0* like expressions in apt 2016-12-08 11:22:26 -05:00
Robert Estelle 4e2d05b1f3 Remove incorrect executable permissions. 2016-12-08 11:22:26 -05:00
Brian Coca 5d16410518 corrected comparisson which had accidentally chaned in previous fixes 2016-12-08 11:22:26 -05:00
Brian Coca 9de01b8e10 better handling of deprecated aliases 2016-12-08 11:22:26 -05:00
Brian Coca f91859c817 make sure 'present' is fully equivalente of 'installed' and remove installed from feedback in favoer of 'present' 2016-12-08 11:22:26 -05:00
James Cammarata a32a50568e Use new prompt detection in run_command to detect aptitude prompts
Also adds flags to aptitude command when force=yes is used, in order
to bypass the prompts given for untrusted packages.

Fixes #31
2016-12-08 11:22:25 -05:00
Michael DeHaan 5d814d9fb2 Some more module categorization. 2016-12-08 11:22:25 -05:00
Lorin Hochstein 06218fe7d2 apt_key: add keyserver example to docs 2016-12-08 11:22:23 -05:00
Michael DeHaan ef2a2b9093 package files 2016-12-08 11:22:22 -05:00
Michael DeHaan 213e518165 file extensions! 2016-12-08 11:22:22 -05:00
Michael DeHaan c7eec45b73 Restructuring. 2016-12-08 11:22:22 -05:00