Commit Graph

9648 Commits (454f741ef5b56cccd123e12d7b2e6fe31d47c755)
 

Author SHA1 Message Date
Toshio Kuratomi 454f741ef5 First set of fixes for uri module to work with py3.
This fix handles changes in the response headers (no longer all
lowercased) and switches from unicode() to to_text().
9 years ago
Jonathan Mainguy ea7005a185 update maintainer 9 years ago
Evan Kaufman b0c94e957e Record existing cron file as string property, rather than only recording termination
This seems less hackish, and feels more proper for diff generation
9 years ago
Evan Kaufman 7c9401a7ff Rendering of crontab should reflect actual newline termination, in diff mode 9 years ago
Evan Kaufman 10b0580ff4 Ensure trailing newline is written to cron file
Records whether existing cron file (or CRONCMD output) has a terminating newline, and ensures a trailing newline is written as necessary EVEN IF NO CHANGE WAS MADE to the target env/job

Fixes #2316
9 years ago
Evgenii Terechkov b16e2597a4 Replace dangerous shell calls with module.run_command 9 years ago
Evgenii Terechkov bfee04d503 Ensure that we use shell
to run apt-get -y install ... >/dev/null

this commit must fix #2839
9 years ago
Rowan Wookey 30ed23bf1c Added work around for Ubuntu Xenial calling php7_module php7.0 9 years ago
Luca Berruti 9c766a9f88 ini_file: return more infos on changes. 9 years ago
Luca Berruti a5e6e4a134 ini_file: diff support. 9 years ago
Luca Berruti 486bedb5e5 ini_file: add create= option. 9 years ago
Luca Berruti 15d62dc17f ini_file: fixes #1788, fails --check when file doesn't exist. 9 years ago
Brian Coca 52e0536fae refactor stat
make format function 'format only'
added platform dependant info, when it is available
avoid rechecking same info
added comments to each info gathering section

(cherry picked from commit a79acf73d7eb79b76d808ff8a1d6c505dfd9ec82)
9 years ago
Toshio Kuratomi 1182d1f0b7 Order of return values was reversed 9 years ago
Toshio Kuratomi ac314a5e3d 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
9 years ago
Toshio Kuratomi 66d47c8149 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
9 years ago
Charles Zaffery 952ad58bda Remove line when 'state: absent' with 'option:' instead of commenting 9 years ago
Adrian Likins 8d3a34ced6 Make authorized_key preserve key order (#5339)
* Make authorized_key preserve key order

Track the ordering of keys in the original file (rank)
and try to preserve it when writing out updates.

Fixes #4780
9 years ago
Toshio Kuratomi ce44f0a0ae Remove the yaml dep from the git module 9 years ago
Toshio Kuratomi a3d4d74d52 Fix git for py3
Comparing to the output of run_command() needs to use native strings

Also fix imports: We were relying on them coming from the import of
basic.  A few (like yaml) weren't imported at all.
9 years ago
Robin Roth 14185067d7 Fix git failure for use of depth with version (#5135)
* Fixes #5108
* before module fails with "fatal: A branch named 'STABLE' already
  exists." when depth is used on a fresh clone with a non-HEAD branch
9 years ago
René Moser 2cb41ce880 doc: add_host: add example without deprecated vars (#5323)
ansible_ssh_* are deprecated since 2.0
9 years ago
John Baublitz 7cfe6df92e GCE: Add support for 'number' parameter for manually provisioned Google Compute clusters (#4276)
* Add option for number parameter to generate manually provisioned clusters from a base name

* Refactor code to work with starting and stopped when number is specified

* Update docs

* Fix documentation error breaking Travis

* Fixes for async gce operations

* Fix documentation

* base_name from parameter to alias for name and fixes for renaming variables

* Fix breaking change on gce.py

* Fix bugs with name parameter

* Fix comments for Github build checks

* Add logic to set changed appropriately for cluster provisioning
9 years ago
Toshio Kuratomi 653ec28a97 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)
9 years ago
Toshio Kuratomi d77027f495 Fix authorized_key module to preserve the order of options
The last fix allowing multiple definitions of the same option key (for
permitopen support) introduced a set() which removed the guaranteed
ordering of the options.

This change restores ordering.  The change is larger than simply
removing the set because we do need to handle the non-dict semantics
around keys not being unique in the data structure.  The new code make
use of __setitem__() and items() to do its work.  Trying to use
getitem() or keys() should be looked upon with suspicion as neither of
those follow dictionary semantics and it is quite possible the coder
doesn't realize this.  The next time we need to touch or enhance the
keydict code it should probably be rewritten to not pretend to extend
the dictionary interface.
9 years ago
Matthew Jones 2508d5f5cb Add separate checkout and update parameters (#5306)
* Add separate checkout and update parameters

This brings the svn module in line with the git module for controlling
individual update and checkout functionality based on whether the
directory exists or not.

It also allows specifying `no` for both to pull the remote revision
without performing a checkout

* Update version-added for new parameters
9 years ago
Matthew Jones bd51222cdf Add separate clone parameter (#5307)
* Add separate clone parameter

This brings the hg module in line with the git module for controlling
individual update and checkout functionality based on whether the
directory exists or not.

It also allows specifying `no` for both to pull the remote revision
without performing a checkout

* Reflect the right added ver for the hg clone arg
9 years ago
Ryan S. Brown 98f6019d86 Remove unused YAML import from cloudformation 9 years ago
Ryan Brown 23da0fc2b8 Support native YAML in CloudFormation module (#5327)
Support the new native YAML format in the CloudFormation API. This means
the existing `template_format` parameter is deprecated. This commit also
adds a warning for the deprecated parameter.
9 years ago
John R Barker 7a7ff3ebca Typo in cleanup (#5322) 9 years ago
Filip Hubík 2d459b797f Fix incorrect line wrapping in output from yum check-updates
https://github.com/ansible/ansible-modules-core/issues/4318#issuecomment-251416661
9 years ago
John R Barker 53e452e88b Run validate-modules from ansible/ansible@devel (#5257)
* Run validate-modules from devel

Use a clean dir for checkout

typo

Correct path

validate-modules requires mock and voluptuous==0.8.8

typo

Ensure script is running

Remove testing debug

Install Ansible only once

Install ansible and validate_modules requirements

Now that we no longer pip install Ansible we need to manually install
it's dependencies

Debug

Dependencies are listed in ansible/ansible

debug

submodules

typo

typo

working

* Matt's feedback

* Use mktemp to checkout and delete directory after running

* Single quotes
9 years ago
Daniel Andrei Minca ced24b7b03 fix unclear documentation for docker container
the docker container module's `exposed_ports` was slightly ambigous.

Use the official Docker documentation to define what an `exposed port`
is.

Resolves: ansible/ansible-modules-core#5303
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
9 years ago
Michael Scherer 6145e24ed4 Fix code for python 3
Since dict.keys return a dictkeys under python 3, we hav to cast it
to a list to avoid traceback:

    Traceback (most recent call last):
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 496, in <module>
        main()
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 490, in main
        results = enforce_state(module, module.params)
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 410, in enforce_state
        parsed_new_key = parsekey(module, new_key)
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 308, in parsekey
        options = parseoptions(module, options)
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 259, in parseoptions
        options_dict[key] = value
      File "/tmp/ansible_sh16ejbd/ansible_module_authorized_key.py", line 164, in __setitem__
        self.itemlist.append(key)
    AttributeError: 'dict_keys' object has no attribute 'append'

Yet another fix for https://github.com/ansible/ansible/pull/18053
9 years ago
Michael Scherer 77c635f18b cleanup import for htpassword module
In order to ease future refactoring, we should avoid importing
'*' from ansible.module_utils.basic.
9 years ago
Michael Scherer 2511500a91 Cleanup import for authorized_key
Do not import '*', to ease future refactoring and cleanup of
module_utils.
9 years ago
Ryan S. Brown cd9e39420b Fix cloudformation module return parameter documentation
Always return stack outputs, even if only an empty dict
9 years ago
tedder d8b015d9c8 Cloudformation module fix unintentional changed=true
- Don't rewrite the result; this is causing 'changed=true' on update
- Move AWSRetry import to top since it's a decorator, and is needed at definition-time
9 years ago
tedder f040d63403 Boto3 rewrite of cloudformation module
- removed star-imports, which wasn't possible in Ansible 1.x
- boto doesn't have any of the modern features (most notably, changesets), so this rewrite goes all-in on boto3.
- tags are updateable, at least in boto3. Fix documentation.
- staying with "ansible yaml to json conversion" because I'm trying to keep this scoped properly. The next PR will have AWS-native yaml support.
- documented the output. Tried to leave it backwards-compatible but the changes to 'events' might break someone's flow. However, the existing data wasn't terribly useful so I don't assume it will hurt.
- split up the code into functions. This should make unit testing possible.
- added forward-facing code: 'six' for iterating, started using AWSRetry, common tag conversion.
- add todo list
- Pass `exception` parameter to fail_json
9 years ago
Michael Scherer 953cd915bb Cleanup imports of xattr
Since the module use re and os, we need to import them.
And rather than importing '*', we should limit to the
only object/function needed, so we can more easily refactor
later.
9 years ago
Dag Wieers 20726b94be 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
9 years ago
Jamie Evans b59b5d36e0 verify both tags and commits (#2654)
This fixes a bug where the module fails to verify tags.  I added a conditional statement in `verify_commit_sign()` that checks if `version` argument is a tag, if so, use `git verify-tag` instead.
9 years ago
Brian Coca ecc4029753 fixed doc typo 9 years ago
Brian Coca 8c9a3175e2 added allow_duplicates to include_role docs 9 years ago
Brian Coca 6e74aa9fbd added allow_duplicates to include_role docs 9 years ago
Michael Scherer 3266efb02f Make the code run on python 3
Test suite block on:

    Traceback (most recent call last):
      File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 496, in <module>
        main()
      File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 490, in main
        results = enforce_state(module, module.params)
      File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 410, in enforce_state
        parsed_new_key = parsekey(module, new_key)
      File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 308, in parsekey
        options = parseoptions(module, options)
      File "/tmp/ansible_fhootp1e/ansible_module_authorized_key.py", line 253, in parseoptions
        if options_dict.has_key(key):
    AttributeError: 'keydict' object has no attribute 'has_key'

With keydict being a subclass of dict.
9 years ago
John R Barker 510214a032 Group "apt-get update" and "apt-get install" (#5283)
* Group "apt-get update" and "apt-get install"

Should speed up sanity

* Run apt-get install in quiet mode
9 years ago
Michael Scherer 6f15dfd464 Make pip module use pip3 on python 3 9 years ago
Michael Scherer 4a0042b1f0 Make subversion module work on python 3
In python 3, filter return a iterator and so result in this traceback:

    Traceback (most recent call last):
      File \"/tmp/ansible_kzu72kz5/ansible_module_subversion.py\", line 264, in <module>
        main()
      File \"/tmp/ansible_kzu72kz5/ansible_module_subversion.py\", line 243, in main
        local_mods = svn.has_local_mods()
      File \"/tmp/ansible_kzu72kz5/ansible_module_subversion.py\", line 178, in has_local_mods
        return len(filter(regex.match, lines)) > 0
    TypeError: object of type 'filter' has no len()
9 years ago
Michael Scherer b0159fe7d3 Remove the wide try/expect clause
This doesn't catch anything precise, and none of the methods should
throw a expection for anything. This also hide python 3 errors.
9 years ago