Commit Graph

21000 Commits (b482cdcf036e372ecde744e7e4f06610344bdc55)
 

Author SHA1 Message Date
Matt Clay b482cdcf03 Fix docker connection unit tests.
- Use assertRaisesRegexp to make sure correct exceptions are raised.
- Set docker_command to avoid docker dependency (skips find_executable).
- Use a fake path for docker_command to make sure mock.patch is working.

(cherry picked from commit 8552ad6bf1)
9 years ago
James Tanner c920c8bc3b ini lookup: add 'default' to the list of parsed keys
Fixes #18369

(cherry picked from commit 20fb74b1b1)
9 years ago
Brian Coca 9499ed5360 restore play_hosts variables to not show removed
Also adds ansible_play_hosts_all with original list of hosts the play targeted

(cherry picked from commit 5dd195b52f)
9 years ago
James Cammarata caba50c778 Merge class dict with parent dict when creating meta attributes
In some situations, where the Base class defines an Attribute, the
BaseMeta class doesn't properly see the _get_parent_attribute or
_get_attr_<whatever> methods because of multiple layers of subclasses
(ie. Handler, which subclasses Task). This addresses that by merging
the __dict__ of the parent with the current classes __dict__ meaning
all future iterations see available special methods.

Fixes #18378

(cherry picked from commit 4794b5da45)
9 years ago
Toshio Kuratomi 58d8a0fca0 Text's .translate() is easier to use than bytes
Text strings and byte strings both have a translate method but the byte
string version is harder to use.  It requires a mapping of all 256 bytes
to a translation value.  Text strings only require a mapping from the
characters that are changing to the new string.  Switching to text
strings on both py2 and py3 allows us to state what we're getting rid of
simply without having to rely on the maketrans() helper function.

(cherry picked from commit ee14e0cc2a)
9 years ago
Michael Scherer aaedf0bd73 Make facts detection work on OpenBSD with Python3
The traceback is the following:

    Traceback (most recent call last):
      File \"/tmp/ansible_8s0bj604/ansible_module_setup.py\", line 134, in <module>
        main()
      File \"/tmp/ansible_8s0bj604/ansible_module_setup.py\", line 126, in main
        data = get_all_facts(module)
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3641, in get_all_facts
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3584, in ansible_facts
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1600, in populate
      File \"/tmp/ansible_8s0bj604/ansible_modlib.zip/ansible/module_utils/facts.py\", line 1649, in get_memory_facts
    TypeError: translate() takes exactly one argument (2 given)

And the swapctl output is this:

    # /sbin/swapctl -sk
    total: 83090 1K-blocks allocated, 0 used, 83090 available

The only use of the code is to remove prefix in case they are present, so just
replacing them with empty space is sufficient.

(cherry picked from commit df145df962)
9 years ago
Adrian Likins 366bfe14c3 Fix bug (#18355) where encrypted inventories fail 18355 (#18373)
* Fix bug (#18355) where encrypted inventories fail

This is first part of fix for #18355
* Make DataLoader._get_file_contents return bytes

The issue #18355 is caused by a change to inventory to
stop using _get_file_contents so that it can handle text
encoding itself to better protect against harmless text
encoding errors in ini files (invalid unicode text in
comment fields).

So this makes _get_file_contents return bytes so it and other
callers can handle the to_text().

The data returned by _get_file_contents() is now a bytes object
instead of a text object. The callers of _get_file_contents() have
been updated to call to_text() themselves on the results.

Previously, the ini parser attempted to work around
ini files that potentially include non-vailid unicode
in comment lines. To do this, it stopped using
DataLoader._get_file_contents() which does the decryption of
files if vault encrypted. It didn't use that because _get_file_contents
previously did to_text() on the read data itself.

_get_file_contents() returns a bytestring now, so ini.py
can call it and still special case ini file comments when
converting to_text(). That also means encrypted inventory files
are decrypted first.

Fixes #18355

(cherry picked from commit dd0189839e)
9 years ago
Dag Wieers 780d2c4bc4 Remove unnecessary warnings (#18121)
(cherry picked from commit cd784cd345)
9 years ago
Brian Coca 1cc26cf7cd resolve inventory path on init
This allows meta refresh_inventory to work with relative paths
Added option to unfrackpath to not resolv symlinks
fixes #16857

(cherry picked from commit 8217c1c39c)
9 years ago
Toshio Kuratomi de7fbd407a Limit how much of the file we read to test if it's an encrypted vault file
Fixes memory errors reported in #16391

(cherry picked from commit ed134d81f1)
9 years ago
Jasper Lievisse Adriaanse 9d81ad6423 Rework how OpenBSD processor facts are resolved
(cherry picked from commit c17dad0def)
9 years ago
Matt Clay 5bf1269aaf Python 3 fixes for ansible-doc.
(cherry picked from commit 88dbb5a630)
9 years ago
James Cammarata 3f25088bf0 Correctly reassign implicit block parents when an include is involved
(cherry picked from commit 7ff9942ec6)
9 years ago
James Cammarata 09fc911a48 Correctly assign parent when squashing adjacent implict Blocks
Related to: #18315
Related to: #18206
Related to: #17810

(cherry picked from commit d12475c98b)
9 years ago
Tony Kinsley 2b9659945c Resolves #18312 python3 support for ec2.py
(cherry picked from commit 73da2663a3)
9 years ago
Robin Roth 182943f3b3 Exclude floppy disks from lsblk call for uuids
Fixes #18326

(cherry picked from commit 6ca6a9a291)
9 years ago
Toshio Kuratomi b229898f80 Add include_vars fix to changelog 9 years ago
Brian Coca 5c4a4703d9 only validate extensions when using dir loading
fixes #18223

(cherry picked from commit 32a7b4ce71)
9 years ago
Patrick Uiterwijk 06599f49eb Fix adding the same trusted certificates multiple times (#18296)
If there is an intermittent network failure, we might be trying to reach
an URL multiple times. Without this patch, we would be re-adding the same
certificate to the OpenSSL default context multiple times.
Normally, this is no big issue, as OpenSSL will just silently ignore them,
after registering the error in its own error stack.
However, when python-cryptography initializes, it verifies that the current
error stack of the default OpenSSL context is empty, which it no longer is
due to us adding the certificates multiple times.
This results in cryptography throwing an Unknown OpenSSL Error with details:

OpenSSLErrorWithText(code=185057381L, lib=11, func=124, reason=101,
reason_text='error:0B07C065:x509 certificate routines:X509_STORE_add_cert:cert already in hash table'),

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
(cherry picked from commit 77af3a68de)
9 years ago
Toshio Kuratomi 3a577966ba Add dnf fixes to changelog 9 years ago
Toshio Kuratomi 6824b1ea1e Update submodule refs 9 years ago
Daniel Menet 00bdada50e fix iteritems for python 3
(cherry picked from commit 19fdb58948)
9 years ago
Adrian Likins 32971e8639 Fix 'vault rekey' with vault secret env var
if ANSIBLE_VAULT_PASSWORD_FILE is set, 'ansible-vault rekey myvault.yml'
will fail to prompt for the new vault password file, and will use
None.

Fix is to split out 'ask_vault_passwords' into 'ask_vault_passwords'
and 'ask_new_vault_passwords' to make the logic simpler. And then
make sure new_vault_pass is always set for 'rekey', and if not, then
call ask_new_vault_passwords() to set it.

ask_vault_passwords() would return values for vault_pass and new
vault_pass, and vault cli previously would not prompt for new_vault_pass
if there was a vault_pass set via a vault password file.

Fixes #18247

(cherry picked from commit 309f54b709)
9 years ago
Toshio Kuratomi 70824e06b5 Update submodule refs 9 years ago
Steve Kuznetsov e13f3e3c07 Change `v2_playbook_on_start` logic to positively detect legacy plugins
In order to support legacy plugins, the following two method signatures
are allowed for `CallbackBase.v2_playbook_on_start`:

def v2_playbook_on_start(self):
def v2_playbook_on_start(self, playbook):

Previously, the logic to handle this divergence checked to see if the
callback plugin being called supported an argument named `playbook`
in its `v2_playbook_on_start` method. This was fragile in a few ways:
 - if a plugin author did not use the literal `playbook` to name their
   method argument, their plugin would not be called correctly
 - if a plugin author wrapped their `v2_playbook_on_start` method and
   by doing so changed the argspec to no longer expose an argument
   with that literal name, their plugin would not be called correctly

In order to continue to support both types of callback for backwards
compatibility while making the call more robust for plugin authors,
the logic can be reversed in order to have a positive check for the old
method signature instead of a positive check for the new one.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
(cherry picked from commit 0bc35354ce)
9 years ago
jasdeep-hundal 6adbc7d64a Fix OpenSSH-related ssh process exit race
Mitigate the effects of observing the ssh process still running
after seeing an EOF on stdout when using OpenSSH with
ControlPersist, since it does not close the stderr file descriptor
in this case.

(cherry picked from commit 679da00236)
9 years ago
Matt Robinson 325bf617e9 Set ansible_os_family correctly under KDE neon
As neon is derived from Ubuntu, ansible_os_family should have the value
"Debian" instead of "Neon".  Add a test case for KDE neon and set
os_family correctly for it.

(cherry picked from commit 4ff8890ec1)
9 years ago
Michael Riss 2c572ba786 Improved caching for urls
- When there is no file at the destination yet, we have no modification time for the `If-Modified-Since`-Header. In this case trust the cache to make the right decision to either serve a cached version or to refresh from origin. This should help with mass-deployment scenarios where you want to use a local cache to relieve your uplink.
- If you don't trust the cache to make the right decision you can still force it to refresh by providing the `force: yes` option.

(cherry picked from commit c05bad9f74)
9 years ago
Toshio Kuratomi 503537eb25 Update for pip fix 9 years ago
James Cammarata cdec853e37 New release v2.2.0.0-1 9 years ago
James Cammarata 23812ab87d Updating CHANGELOG for CVEs fixed in 2.2.0 9 years ago
Nathaniel Case 1f80e35312 Exception.message gone in 3.x (#18221)
* Exception.message gone in 3.x
(cherry picked from commit 4a067c3f50)
9 years ago
Toshio Kuratomi c07f6d1bdd Update submodule refs 9 years ago
Toshio Kuratomi d559355b29 Add tests for dnf modelled after the yum tests (#18226)
(cherry picked from commit 02859a3e32)
9 years ago
Sijis Aviles 219a20277f Simplify surrogate check in to_text() (#18211)
* Simplify surrogate check in to_text()

* Simplify surrogateescape check even further

(cherry picked from commit b365f44fa1)
9 years ago
Michael Scherer 3de9d8373b Cleanup StringIO import for module_utils/shell.py
(cherry picked from commit 6052c1294b)
9 years ago
James Cammarata 9d4ce0a94e New release v2.2.0.0-0.4.rc4 9 years ago
Toshio Kuratomi c5d4134f37 Add hint that python3 might be too old
This limitation of python-3.4 mkstemp() is the final reason we made
python-3.5 our minimum version.  Since we know about it, give a nice
error to the user with a hint that Python3.4 could be the issue.

Fixes #18160

(cherry picked from commit fda933723c)
9 years ago
jctanner 95a8bbdbda iterate through task results only if the key is not at the root level (#18214)
Fixes https://github.com/ansible/ansible-modules-core/issues/5396
(cherry picked from commit 5a0621db55)
9 years ago
Rene Moser 1ebc94f290 tasks_queue_manager: fix fork calculation if serial in %
(cherry picked from commit 3763283d01)
9 years ago
Toshio Kuratomi a2df07ade3 A few fixes for python3
* socket interfaces take bytes so convert text strings to bytes when
  using them.
* Use b64encode() instead of str.encode('base64')

(cherry picked from commit 56086f3b9e)
9 years ago
Foxlik 6b603b026c Fix #10865
Slightly better handling of http headers from http (CONNECT) proxy. Buffers up to 128KiB of headers and raises exception if this size is exceeded.

This could be optimized further, but for the time being it does the trick.
(cherry picked from commit 8bb01d4c29)
9 years ago
Matt Davis deb1e3ebc7 bump core submodule ref for win_shell/win_command fixes 9 years ago
Matt Davis 79e43925b1 add large interleaved stdout/stderr integration tests for win_shell/win_command
(cherry picked from commit c1b7d2e560)
9 years ago
Matt Davis 0eb23f5a86 fix version check to support >=rc5
(cherry picked from commit d1e1898b0e)
(cherry picked from commit 12a38bc75f)
9 years ago
Matt Davis 066a360a36 backport various docker_common fixes from devel
(cherry picked from commit b5c95ea6fa)
9 years ago
Will 731422a6dc Fix lxd_container module fails if certificate already in trust store
When the client certificate is already stored, lxd returns a JSON error with message "Certificate already in trust store". This "error" will occur on every task run after the initial run. The cert should be in the trust store after the first run and this error message should really only be viewed as informational as it does not indicate a real problem.

Fixes:
ansible/ansible-modules-extras#2750
(cherry picked from commit 1f30bc8a6f)
9 years ago
Toshio Kuratomi 96d3f06743 Add a new potential su prompt
Two parts to this change:
* Add a new string that requests password
* Add a new glyph that can be used to separate the prompt from the
  user's input as it seems it can use fullwidth colon rather than colon.

Fixes #17867

(cherry picked from commit 188ae18b1c)
9 years ago
James Cammarata eafb4043c9 New release v2.2.0.0-0.3.rc3 9 years ago
Thomas Quinot 35938b907d Filter out internal magic and connection variables from facts returns
Fixes #15925

(cherry picked from commit f826370ab8befacf2e8867ee3d7e2b814a3da385)
9 years ago