Commit graph

31 commits

Author SHA1 Message Date
Stephen Fromm
8f0d8a8546 Update various modules for check_mode
This updates the following modules to support check_mode:
* apt_key
* apt_repository
* easy_install
* pip - will always report changed due to the way it handles state
* seboolean
* selinux
* slurp - since nothing changes, it just adds that it supports
  check_mode
* subversion - reports changed when checking out new repo and
  when updating.
* supervisorctl
* svr4pkg

See issue #2114.
2013-02-27 12:23:35 -08:00
Daniel Hokka Zakrisson
578ec127fb Remove choices=BOOLEANS as it is no longer needed 2013-02-23 22:57:36 +01:00
Daniel Hokka Zakrisson
df798d0688 Use argument type checking to convert to boolean 2013-02-23 19:59:52 +01:00
Michael DeHaan
8b3ebf0d10 mark when various new flags were added to the pip & easy_install modules 2013-02-23 12:51:23 -05:00
Jeroen Hoekx
9f65233e96 Easy_install and pip module support a virtualenv_command parameter.
This allows flexible selection of the Python version to use while
creating the virtualenv.
2013-02-20 14:52:02 +01:00
Blair Zajac
106fb10dab library/pip: add support for virtualenv's --system-site-packages. 2013-02-04 17:03:25 -08:00
Stephen Fromm
3fb21a5281 Update modules to use run_command in module_common.py
This updates apt, apt_repository, command, cron, easy_install, facter,
fireball, git, group, mount, ohai, pip, service, setup, subversion,
supervisorctl, svr4pkg, user, and yum to take advantage of run_command
in module_common.py.
2013-01-13 08:37:19 -08:00
Norman J. Harman Jr
19b84d0527 pip module improvements
- Do not silently ignore malformed pip requirements files.
- Properly reports changed when removing packages.
- "latest" i.e. --upgrade is *not* incompatible with requirements files.
- Less branchy, simpler logic.
- Removed pointless variable "initializations", Python doesn't need that.
  Other code simplifications.
- Fun fact; pip install is (kind of) case insensitive, pip freeze is not.
  So, 'sqlalchemy' will be reported as installed by install, but missing
  by freeze.

The perhaps controversial change and the one that led to finding /
fixing above issues...

Instead of adding command parameters 'index', and 'find', and 'mirrors',
and etc.  Added 'extra_args' which are passed onto pip.

The use case for --index-url is having a private pypi repo, like
http://pypi.python.org/pypi/localshop, to which you publish private
packages.  I'm sure most every pip option has a use case for someone.
extra_args handles all those. Can reserve ansible command parameters for
the most common.

Tested with pip 1.1.
2012-12-12 15:40:25 -06:00
Stephen Fromm
5b7c8fcc38 Further tweak how to find pip in virtualenv on centos/redhat/fedora
In a virtualenv, pip is called just pip.  This fixes the pip module to
search for the virtualenv pip first before trying the pip-python and
python-pip variants.  Without this, pip module would not install to the
virtualenv when that parameter is provided.
2012-12-02 08:13:10 -08:00
Stephen Fromm
e33e02950d Make use of mirrors in pip module configurable with use_mirrors option
Older versions of pip (anything less than 1.0?) do not support
--use-mirrors flag.  This makes it configurable.  Default is yes.
2012-12-02 08:04:27 -08:00
Stephen Fromm
d277953a53 Fix pip module to check if requirements already installed
This updates _is_package_installed() to accept a requirements file
as an argument.  This is used later in main() to check if python libs
specified in a requirements file are already installed.  I updated
main() to consolidate the handling of install/uninstall in a single
block.  This should help if someone wants to remove packages specified
by a requirements file.
2012-12-01 20:00:21 -08:00
Ton Kersten
7bba04b176 Corrected for fallthrough 2012-11-24 16:26:15 +01:00
Ton Kersten
ee4fe9ff55 Added pip-python to the search for CentOS 6 compatibility 2012-11-24 13:36:32 +01:00
Jan-Piet Mens
caf003c813 DOCUMENTATION strings 2012-11-21 18:49:30 +01:00
Michael DeHaan
663a8fef3f chmod -x for all module files in source checkout 2012-11-19 13:47:40 -05:00
Jan-Piet Mens
feab57e270 Reformat code: examples consistently
- added terse syntax to modules.rst
 - added description of special variables to template module
2012-10-23 15:14:01 +02:00
Maxim Burgerhout
2f6b9e69a7 Test for python-pip as well as pip
On Red Hat, CentOS and Fedora systems, the pip binary will be called python-pip
instead of pip. This commit makes the pip module also check for python-pip.

The reason we check for python-pip *first*, is to have ansible fail on not
finding 'pip' and reporting *that*. This is consistent with current behaviour
and will not confuse users of Debian et al., where the 'python-pip' binary
never exists.

Tested on Fedora 18 and Ubuntu 12.04.
2012-10-14 12:14:59 +02:00
Jan-Piet Mens
e620fed755 Jumbo DOCUMENTATION patch 2012-10-01 09:18:54 +02:00
Marco Vito Moscaritolo
d80ec35183 Fixed error in author name 2012-09-29 21:04:17 +02:00
Marco Vito Moscaritolo
ac5afcae28 Added DOCUMENTATION to pip module. 2012-09-29 20:53:28 +02:00
Stephen Fromm
6742e9c3f4 Add option required=(True|False) to get_bin_path and update modules
Added required as optional argument to get_bin_path(). It defaults to
false.  Updated following modules to use required=True when calling
get_bin_path():  apt_repository, easy_install, group, pip,
supervisorctl, and user.
Also removed _find_supervisorctl() from supervisorctl module and updated
_is_running() to not need it.
2012-08-30 11:01:37 -07:00
Stephen Fromm
e5a635672c Migrate remaining modules to use get_bin_path in module_common.py
* Migraed easy_install, pip, service, setup, and user.
* Updated fail_json message in apt_repository
* Fixed easy_install to not hardcode location of virtualenv in
  /usr/local/bin/.
* Made handling of virtualenv more consistent between easy_install and
  pip.
2012-08-29 20:26:22 -07:00
Michael DeHaan
705057b9a6 Merge pull request #900 from lorin/pip-venv-bug
Retrieve pip path after creating virtualenv
2012-08-17 17:10:35 -07:00
Lorin Hochstein
8223d3ee3f Retrieve pip path after creating virtualenv
Retrieve the pip path after creating a non-existent virtualenv.
Prevents the problem of using the wrong pip if virtualenv doesn't
exist yet.
2012-08-17 14:38:49 -04:00
Lorin Hochstein
8af3403f65 Return both stdout and stderr on pip failures.
pip failure message sometimes (always?) go to standard out. Return
both standard out and standard error when there's a failure.
2012-08-17 11:32:47 -04:00
Michael DeHaan
1e4d45af1e Add module common code to allow it to be easier to indicate whether arguments are mutually exclusive, required in conjunction, or whether one of a list of arguments is required. This simplifies writing Python modules. 2012-08-11 18:13:29 -04:00
Sébastien Bocahu
487d07a845 Fix variable scope 2012-08-10 21:58:58 +02:00
Sundar Raman
66a6231922 Further syntax fix work on Python2.4
The `val if something else something-else` syntax does not work prior to 2.5.
2012-08-09 18:09:18 -04:00
Sundar Raman
9ad91d7369 Fix syntax to work on Python2.4
The `val if something else something-else` syntax does not work prior to 2.5
2012-08-09 17:54:29 -04:00
Matt Wright
0116e53e48 Updates per ansible/ansible#796 2012-08-08 10:35:07 -04:00
Matt Wright
4de0e5de54 add pip module 2012-08-07 16:38:04 -04:00