Commit Graph

317 Commits (05c74cee4757cbbf92799ae82cd6834feda12ac9)

Author SHA1 Message Date
Vlad Glagolev 45b2f4b479 Source Mage GNU/Linux package manager support (#19072)
* added alpha version of the 'sorcery' module

* fully conforming YAML

* use bundled check for executables

* - codex_list(): use commands instead of checksums to get sorcery version and verify codex equality - renamed: - manage_depends() -> match_depends() - tocast -> cast_queue, todispel -> dispel_queue, needs_recast -> depends_ok - SORCERY_LOG -> SORCERY_LOG_DIR, SORCERY_STATE -> SORCERY_STATE_DIR - removed: - SORCERY_VERSION_FILE - CODEX - added commentary to match_depends() and manage_spells() - fixed bug about dropped dependency line for previously existed dependency - fixed bug about not fixing depends for the 'latest' state - simplified several code constructions

* cleaned up some docs

* do not use separate message for Codex update, rely on the 'changed' status instead

* use built-in list conversion (_check_type_list()) for spells

* corrected spell name extraction from list in match_depends()

* avoid non-matching dependencies line duplication in depends file

* added more complex playbook example

* tiny stylistic fix for docs

* replaced ternary construction with a regular statement

* replaced yet another ternary construction with a regular statement

* enable Python 2.4 compatibility by splitting try-finally block

* enable Python 2.4 compatibility by replacing 'with' statement with try-except+try-finally blocks

* unify spells' assign

* replaced one regex with startswith()

* go Ansible 2.1

* added dummy RETURN template

* go Ansible 2.2

* better clarify permissions' requirements

* - updated copyright years - fixed rebuild command bug - re-used run_command_environ_update dict for env var management

* handle Python 3.5

* Revert "handle Python 3.5"

This reverts commit 33a5a0eb64c1193318298e111f063cdd5f93b73a.

* handle Python 3.5 (2nd try)

* go Ansible 2.3

* clarity++
2016-12-10 16:38:15 -05:00
Matt Clay c709b22e5c Fix differences with devel. 2016-12-08 11:35:21 -05:00
James Cammarata 011ea55a8f Relocating extras into lib/ansible/modules/ after merge 2016-12-08 11:35:18 -05:00
James Cammarata 8afa090417 Resolving differences in core modules post-merge 2016-12-08 11:25:36 -05:00
Toshio Kuratomi 7319104552 Refreshed metadata for core modules 2016-12-08 11:25:35 -05:00
Fabio Alessandro Locati 5edbbabe0b Call main in conditional way - packaging (#5826) 2016-12-08 11:25:35 -05:00
Fabio Alessandro Locati 8ae7d2dcc4 Unquote urls in YAML - packaging (#5793) 2016-12-08 11:25:34 -05:00
Toshio Kuratomi 52698596bc Clarify the comment 2016-12-08 11:25:31 -05:00
Toshio Kuratomi 91d98bb1a6 Older versions of rhn-client-tools don't understand containment tests. 2016-12-08 11:25:31 -05:00
Dag Wieers 54fdff16db Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .keys()
http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
2016-12-08 11:25:31 -05:00
Dag Wieers c843eeabc2 Performance improvement using in-operator for hash lookups
Just a small cleanup for the existing occurrences.

Using the in-operator for hash lookups is faster than using .has_key()
http://stackoverflow.com/questions/1323410/has-key-or-in
2016-12-08 11:25:31 -05:00
Sam Doran 2bb5ab9776 Change example syntax on pip module 2016-12-08 11:25:30 -05:00
Sam Doran d42f73f5e9 Change example syntax on gem module 2016-12-08 11:25:30 -05:00
Sam Doran 8a1bd4178a Change example syntax on easy_install module 2016-12-08 11:25:30 -05:00
Sam Doran 4c93d3edf0 Change example syntax on yum module 2016-12-08 11:25:30 -05:00
Sam Doran ea3c8ee406 Change example syntax on rpm_key module 2016-12-08 11:25:30 -05:00
Sam Doran 66c92d5623 Change example syntax on rhn_register module 2016-12-08 11:25:30 -05:00
Sam Doran 25af0652b9 Change example syntax on rhn_subscription module 2016-12-08 11:25:30 -05:00
Sam Doran 3208cf5abf Change example syntax on redhat_subscription module 2016-12-08 11:25:30 -05:00
Sam Doran 6c16ab6ca8 Change example syntax on package module 2016-12-08 11:25:30 -05:00
Sam Doran ca12f5acac Change example syntax on apt_rpm module 2016-12-08 11:25:30 -05:00
Sam Doran e4978ea98d Change example syntax on apt_repository module 2016-12-08 11:25:30 -05:00
Sam Doran b2ffded3a7 Change example syntax on apt_key module 2016-12-08 11:25:30 -05:00
Sam Doran f8ce66cbde Change example syntax on apt module 2016-12-08 11:25:30 -05:00
jctanner 019acfa9b0 Correct the handling of state=latest for yum groups. (#4141)
* Correct the handling up state=latest for yum groups.
* Use yum-deprecated when available

Fixes #4119
2016-12-08 11:25:27 -05:00
René Moser 447842c524 apt: fix changed when cache updated but not pkg (#5487) 2016-12-08 11:25:26 -05:00
Matt Martz 08ce50c2b3 If fetch_url failed to download the URL fail early with a proper error message. Fixes #5474 (#5476) 2016-12-08 11:25:26 -05:00
Matt Robinson df70a58d72 apt_repository: Relax PPA checks and add basename (#5432)
Allow installation of PPA repositories on non-Ubuntu Debian derived
distribution targets (e.g. neon, Mint, Debian itself) by removing the
specific check for UbuntuDistribution before allowing PPA: format
sources. This fixes the addition of PPA repositories under KDE neon (as
the codenames match the base Ubuntu distribution).

To make the functionality also useful under Mint and Debian which have
different codenames to their Ubuntu upstream / downstream releases, add
a 'codename' option to override the default used in the PPA source
entry.
2016-12-08 11:25:26 -05:00
Chris Becker fabb63c43f Add more specific language to module description and examples
* Add 'on the remote server' to `file` parameter description
* Add example showing how to use the `file` parameter, with specific
  language about the file's location being on the 'remote server'
2016-12-08 11:25:25 -05:00
jctanner 60dd2f1fff apt: update cache until corrupt package lists are fixed (#5448)
* apt: If the cache object fails to lost due to a corrupt file, try to update the cache until it is fixed.
* Append -q to the update parameters
* Remove unused variable
* Use a string that doesn't rely on internationalization
* Use py24 exception style
* Use get_exception

Fixes #2951
2016-12-08 11:25:25 -05:00
Toshio Kuratomi 0d74ae3368 Need to locate a pip inside a venv when venv is specified
Alternative to #5359

Fixes #5347
2016-12-08 11:25:24 -05:00
Evgenii Terechkov da71acf1bf Replace dangerous shell calls with module.run_command 2016-12-08 11:25:23 -05:00
Evgenii Terechkov 8fd4785062 Ensure that we use shell
to run apt-get -y install ... >/dev/null

this commit must fix #2839
2016-12-08 11:25:23 -05:00
Toshio Kuratomi e2fce828f6 Order of return values was reversed 2016-12-08 11:25:23 -05:00
Toshio Kuratomi 9aac87e08c Fix builddep when a source package exists without a binary package
builddep only requires a source package to be in the repos but our code
was checking for a binary package before running buiddep.  Reversing the
order makes it work correctly.

Fixes #4519
2016-12-08 11:25:23 -05:00
Toshio Kuratomi b8279e7447 Only change to short IDs for delete (#5353)
* Only change to short IDs for delete

If the user specifies long IDs, use them for all commands except for
deleting a key.  Need to use short IDs there because of an upstream
apt_key bug.  Fixed in apt_key 1.10 (fix is present in Ubuntu 16.04 but
not Ubuntu 14.0 or some Debians).

Fixes #5237

* Check that apt-key really erased the key

When erasing a key, apt-key does not understand how to process subkeys.
This update explicitly checks that the key_id is no longer present and
throws an error if it is.  It also hints at subkeys being a possible
problem in the error message and the documentation.

Fixes #5119

* Fix apt_key check mode with long ids

apt-key can be given a key id longer than 16 chars to more accurately
define what key to download.  However, we can use a maximum of 16
chars to verify whether a key is installed or not.  So we need to use
different lengths for the id depending on what we're doing with it.

Fixes #2622

Also:

* Some style cleanups
* Use get_bin_path to find the path to apt-key and then use that when
  invoking apt-key
* Return a nice user error message if the key was not found on the
  keyserver
* Make file and keyring parameters type='path' so envars and tilde are
  expanded
2016-12-08 11:25:23 -05:00
Toshio Kuratomi ff6bac126e On Ubuntu16, virtualenv always tries to use python2 even when python2 is not installed.
Workaround that by mimicing the upstream virtualenv behaviour in code
(use the python version that was used to invoke virtualenv/the ansible
module)
2016-12-08 11:25:22 -05:00
Filip Hubík 9a2d8337f2 Fix incorrect line wrapping in output from yum check-updates
https://github.com/ansible/ansible-modules-core/issues/4318#issuecomment-251416661
2016-12-08 11:25:22 -05:00
Dag Wieers 858d02ac4c Ensure yum failures in with-loop result into a failed task
The implementation is fairly simple, we force the rc= parameter to not be zero so that the check in _executor/task_result.py_ correctly determines that it failed. Without this change Ansible would report the task to be ok (despite failed=True and msg=Some_error_message) although Ansible stops and the summary output reports a failed task.

This fixes #4214, #4384 and also relates to ansible/ansible#12070, ansible/ansible#16006, ansible/ansible##16597, ansible/ansible#17208 and ansible/ansible#17252
2016-12-08 11:25:21 -05:00
Michael Scherer 9e3058c323 Make pip module use pip3 on python 3 2016-12-08 11:25:21 -05:00
Alfredo Solano 88d7f0c692 apt: doc: use yaml syntax in examples (#5070) 2016-12-08 11:25:20 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
John Barker bca8bbe7c2 Correct functional typos 2016-12-08 11:25:19 -05:00
Kevin Carter e2e7f20e34 apt: fix cache time handling (#1517)
This change is in response to issue #1497 where the apt module would not properly updating the apt cache in some situations and never returned a state change on cache update when the module was used without or without an item to be installed or upgraded.

The change simply allows the apt module to update the cache when update_cache option is used without or without a set cache_valid_time.
If cache_valid_time is set and the on disk mtime for apt cache is ">" the provided amount of seconds, which now has a default of 0, the apt cache will be updated. Additionally if no upgrade, package, or deb is installed or changed but the apt cache is updated the module will return a changed state which will help users to know that the state of the environment has changed due to a task operation, even if it was only an apt cache update.

fixes #1497

Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2016-12-08 11:25:14 -05:00
Toshio Kuratomi 77975c232b Fix pip freeze workaround with virtualenv (#4951) 2016-12-08 11:25:12 -05:00
Toshio Kuratomi a8fbdcd80d pip list isn't available on pip less than 1.3 so make a fallback (#4947) 2016-12-08 11:25:12 -05:00
Toshio Kuratomi e2963c0e25 Fix parsing of pip output 2016-12-08 11:25:12 -05:00
Rob Cutmore 15b41d2718 Pip: use 'pip list' when available for package list (#4644)
* Pip: handle parsing different pip commands

* Pip: use 'pip list' when available

* Pip: explicitly check which command is used

* Pip: add error checking when fetching packages
2016-12-08 11:25:11 -05:00
Will Thames 10af591da2 Check whether yum file or URL install is an upgrade (#4547)
Rather than just checking whether a package with the right
name is installed, use `local_nvra` to check whether the
version/release/arch differs too.

Remove `local_name` as it is a shortcut too far.

Fixes #3807
Fixes #4529
2016-12-08 11:25:11 -05:00
Matt Clay 49692e98eb Fix python 3 issues with apt* modules. (#4848)
- Use range instead of xrange.
- Use python3-apt package for python 3.
- Eliminate unsupported for/else/raise usage.
- Use list on dict.items when modifying dict.
- Update requirements documentation.

Also made non-intrustive style fixes (adding blank lines).
2016-12-08 11:25:05 -05:00
Matt Clay e8f70f25df Python 3 fixes for apt_* modules. (#4754) 2016-12-08 11:25:03 -05:00
Toshio Kuratomi 5bd9cdad5a We've decided that pythn 3.5 is the minimum python3 version (#4572) 2016-12-08 11:24:57 -05:00
Guillaume Delpierre 90bf5434d0 gem: add support for --env-shebang (#4377)
* gem: add support for --env-shebang

* fix version added
2016-12-08 11:24:55 -05:00
Alexey Sheplyakov 8d4fe2a767 apt_key: fix spurious failure to import a subkey (#4366)
Importing a (sign only) subkey with apt_key module always fails,
however the actual keyring gets created and contains the correct keys.
Apparently the all_keys function skips the subkeys, hence the problem.

Fixes #4365
2016-12-08 11:24:50 -05:00
Evan 7b66bdc1c4 pip: Fix uninitialized variable during check_mode (#4379)
During check_mode (`--check`), the variable change could be
used uninitialized, yielding this error:

`UnboundLocalError: local variable 'changed' referenced before assignment`

This changeset simply initializes it to False.
2016-12-08 11:24:49 -05:00
Jan Hutař 5eb4e0dd0d Add way to specify environment (#3453) 2016-12-08 11:24:43 -05:00
Brian Coca ad996f162b name was the issue, not pkg 2016-12-08 11:24:41 -05:00
Brian Coca d8e91f01b0 protect another portion against None name 2016-12-08 11:24:41 -05:00
Brian Coca 506e6ff2e2 another fix for None in name 2016-12-08 11:24:41 -05:00
Brian Coca c871f488eb avoid traceback when name is None 2016-12-08 11:24:41 -05:00
Brian Coca f874c29dff allow pip to take a list of names (#4056)
also simplified argspec by removing defaults
2016-12-08 11:24:41 -05:00
Adrian Likins e2bd4a87d8 Update docs and internal naming s/RHN/RHSM (#3977) 2016-12-08 11:24:41 -05:00
Adrian Likins 09b34c764a Add 'force_register' to redhat_subscriptions (#3976)
Fixes #2448
2016-12-08 11:24:41 -05:00
Adrian Likins 127b854d2c Fix default perm for apt_repo files. (#4072)
Change the file mode arg to 'raw' ala file args

Following the file_common_args model, change the
type of the 'mode' arg here to type='raw' with no
default arg value.

The default mode for file creation is the module
constant DEFAULT_SOURCES_PER, and is used if no
mode os specified.

A default mode of 0644 (and not specified as int or str)
would get converted to an octal 420, resulting in the
sources file being created with mode '0420' instead of '0644'

Fixes #16370
2016-12-08 11:24:41 -05:00
Brian Coca f9cb5ecc3c removed extra space
as pointed out by @lloydbenson
2016-12-08 11:24:40 -05:00
jctanner 4480b8d37f Cleanup unused variable in yum.py (#4009) 2016-12-08 11:24:40 -05:00
Erik Nadel 4619513d9e apt remove now recognizes the force parameter (#3756) 2016-12-08 11:24:39 -05:00
mattymo 5692d28f93 Add retries to apt_key with keyserver, fixes #3986 (#3987)
Public SKS gpg servers frequently are unavailable, but a retry
can mitigate frequent failures.
2016-12-08 11:24:39 -05:00
jctanner 17ebf51bd4 Add local and url support to yum state=latest (#4003)
Fixes #3807
2016-12-08 11:24:39 -05:00
René Moser b7265d7b28 apt: fix deb=file with --diff does not show diff on upgrades (#3826) 2016-12-08 11:24:33 -05:00
René Moser a85d9930c5 apt: fix KeyError for deb=file (#3816)
Fix KeyError: 'prepared' while installing dependencies using deb=<file>.deb
This error shows up when --diff was not passed by and the deb files has dependencies not yet installed.
Closes #3752.
2016-12-08 11:24:33 -05:00
james-prior 68b9c2ffa7 Make explicit that virtualenv is created if needed for pip module. (#3731)
packaging/language/pip.py:
    virtualenv option:
        Mention that virtualenv is created if it does not exist.
            (Explicit is better than implicit.)
        Mention other relevant options.
    notes:
        initialized -> created
    Wrap long lines.
2016-12-08 11:24:31 -05:00
Michael Scherer b8175f70ce Convert packaging/* to py3/py2.4 syntax (#3702) 2016-12-08 11:24:30 -05:00
Matt Martz a2d94c85e9 2 Module fixes (#3611)
* Fix syntax error in azure_rm_virtualmachine.py

* Allow rhn_register to fail gracefully when rhn-client-tools is not installed
2016-12-08 11:24:30 -05:00
René Moser 326f7166c0 apt: fix always changed when using deb file on Debian 8 (#3541)
Extends d74e82a3f1e3293ffb70c172e5bb2b6e1ff6dbcc with also support
downgrade.
2016-12-08 11:24:26 -05:00
Pomin Wu d997c79487 Fixed #3577 (#3578)
Initialize `upgradable` before use.
2016-12-08 11:24:26 -05:00
Toshio Kuratomi 5f0dc2b90f Some beginning python3 porting for modules which have unittests 2016-12-08 11:24:24 -05:00
Michael Scherer ce0be575e2 Change gem_source and executable to 'path'
Both of them are file location, so they should be
marked as 'path'.
2016-12-08 11:24:24 -05:00
Adrian Likins 4141cc5548 improve redhat_subscription documentation (#3348)
* add subscription-manager's --type, --consumerid, --name option support

* redhat_subscription: More docs on consumerid
2016-12-08 11:24:19 -05:00
Michael Scherer 69f2b3d727 Fix error reporting for fetch_key (#2662)
Since fetch_url already take care of the exception, the try/except
clause is no longer working, so replace it with proper status
checking, thus permitting to remove urlib2 from the import list.
2016-12-08 11:24:19 -05:00
Jan Hutař d91f803897 Add support for Satellite/Spacewalk which have slightly different API to Hosted (#3289) 2016-12-08 11:24:19 -05:00
Toshio Kuratomi 9e9b6a24f4 Fix apt module needing another format character 2016-12-08 11:24:19 -05:00
NielsH 1b94aa2d43 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-12-08 11:24:18 -05:00
Tobias Wolf fb5a91d9d1 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-12-08 11:24:18 -05:00
Oleg Senin 7ceaafbbd2 Correct misspell (#3454) 2016-12-08 11:24:18 -05:00
John Barker b3bc4bc97f Add copyright notice for James Laska 2016-12-08 11:24:17 -05:00
Adrian Likins 2a7324a385 Update redhat_subscriptions 'server_insecure' docs (#3373)
'server_insecure' maps to the subscription-manager config
(/etc/rhsm/rhsm.conf) value for 'insecure' key in the
'server' stanza. The 'insecure' configures if the https connection
to 'server_hostname' is verified as having been issued by
a CA in 'ca_cert_dir' trust store.

Previous documentation indicating it disables https and
enables http was inaccurate. Connection to server_hostname
always uses https.
2016-12-08 11:24:17 -05:00
Jan Hutar 45076bddb9 Add missing parameters so these options are usable 2016-12-08 11:24:15 -05:00
Michael Scherer 65243dfb91 Fix type of the rhn_register module
Password and activationkey should be tagged as no_log, as they
are supposed to be secret.
sslcacert is a path, so should be tagged as such.
2016-12-08 11:24:15 -05:00
Hugh Saunders 92ebeffd6c Retry apt cache updates 2016-12-08 11:24:14 -05:00
Strahinja Kustudić db45268b75 Yum module always downloads remote rpms. fixes #1452 2016-12-08 11:24:14 -05:00
Rene Moser 775521e5cb apt: doc: fix missing version_added
see #2023
2016-12-08 11:24:13 -05:00
Chris Lamb c012358d57 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-12-08 11:24:13 -05:00
Toshio Kuratomi b70d691832 Fix indent in documentation 2016-12-08 11:24:13 -05:00
Raphaël Dubigny 71c50aed24 typo in pip module 2016-12-08 11:24:13 -05:00
Roland Sommer 0c1cf5ee1c honour 'only_upgrade' flag for 'build_dep' case in 'apt' module 2016-12-08 11:24:13 -05:00
toshihisa 7fee8a78c9 One more bug yum non English locales
d7fac82f97
2016-12-08 11:24:12 -05:00
Roland Sommer c96d5245f5 add 'only_upgrade' switch to apt module 2016-12-08 11:24:11 -05:00
Matt Martz ad9c487391 Set version_added to 2.1 for autoremove. Fixes #3200 2016-12-08 11:24:10 -05:00
Matt Martz b4bab770f6 pip module should call exit_json for absent as well (indentation error) 2016-12-08 11:24:10 -05:00