Commit graph

38602 commits

Author SHA1 Message Date
Ryan Reed
e215f842ba Correcting conditionals looping (#43331)
Empty conditionals would not break out of the loop, causing every command to be run for the same number of times as retries is defined (10 by default)
2018-07-27 10:42:34 +05:30
Abhijeet Kasurde
dd73bae51a VMware: handle indexError for snapshot details (#42575)
Fixes: #42539

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-07-27 00:55:21 -04:00
Adrián Matellanes
c62d9a023a Fix zabbix-template module error version comparison (#39199)
* Fix zabbix-template module error version comparison

* Fix zabbix-template module error version comparison
2018-07-27 00:18:02 -04:00
Vladimir Dobriakov
92ab566527 Make example work: "Import Zabbix Temlate" (#40905)
<!--- Small typo, but it was hard to find, why the ansible module execution failed -->

+label: docsite_pr
2018-07-27 00:12:20 -04:00
Andreas Olsson
ab41fb9cd4 Fix cloudflare_dns proxied change detection (#43096)
Resolves #35190
2018-07-27 09:27:05 +05:30
Abhijeet Kasurde
604fcb55ae
VMware: add support for boot option firmware (#42730)
This fix adds support for the boot option 'firmware'

Fixes: #42541

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-07-27 09:18:04 +05:30
Toshio Kuratomi
dce0a8d052 Switch to imp.load_module 2018-07-26 20:07:25 -07:00
Toshio Kuratomi
52449cc01a AnsiballZ improvements
Now that we don't need to worry about python-2.4 and 2.5, we can make
some improvements to the way AnsiballZ handles modules.

* Change AnsiballZ wrapper to use import to invoke the module
  We need the module to think of itself as a script because it could be
  coded as:

      main()

  or as:

      if __name__ == '__main__':
          main()

  Or even as:

      if __name__ == '__main__':
          random_function_name()

  A script will invoke all of those.  Prior to this change, we invoked
  a second Python interpreter on the module so that it really was
  a script.  However, this means that we have to run python twice (once
  for the AnsiballZ wrapper and once for the module).  This change makes
  the module think that it is a script (because __name__ in the module ==
  '__main__') but it's actually being invoked by us importing the module
  code.

  There's three ways we've come up to do this.
  * The most elegant is to use zipimporter and tell the import mechanism
    that the module being loaded is __main__:
    * 5959f11c9d/lib/ansible/executor/module_common.py (L175)
    * zipimporter is nice because we do not have to extract the module from
      the zip file and save it to the disk when we do that.  The import
      machinery does it all for us.
    * The drawback is that modules do not have a __file__ which points
      to a real file when they do this.  Modules could be using __file__
      to for a variety of reasons, most of those probably have
      replacements (the most common one is to find a writable directory
      for temporary files.  AnsibleModule.tmpdir should be used instead)
      We can monkeypatch __file__ in fom AnsibleModule initialization
      but that's kind of gross.  There's no way I can see to do this
      from the wrapper.

  * Next, there's imp.load_module():
    * https://github.com/abadger/ansible/blob/340edf7489/lib/ansible/executor/module_common.py#L151
    * imp has the nice property of allowing us to set __name__ to
      __main__ without changing the name of the file itself
    * We also don't have to do anything special to set __file__ for
      backwards compatibility (although the reason for that is the
      drawback):
    * Its drawback is that it requires the file to exist on disk so we
      have to explicitly extract it from the zipfile and save it to
      a temporary file

  * The last choice is to use exec to execute the module:
    * https://github.com/abadger/ansible/blob/f47a4ccc76/lib/ansible/executor/module_common.py#L175
    * The code we would have to maintain for this looks pretty clean.
      In the wrapper we create a ModuleType, set __file__ on it, read
      the module's contents in from the zip file and then exec it.
    * Drawbacks: We still have to explicitly extract the file's contents
      from the zip archive instead of letting python's import mechanism
      handle it.
    * Exec also has hidden performance issues and breaks certain
      assumptions that modules could be making about their own code:
      http://lucumr.pocoo.org/2011/2/1/exec-in-python/

  Our plan is to use imp.load_module() for now, deprecate the use of
  __file__ in modules, and switch to zipimport once the deprecation
  period for __file__ is over (without monkeypatching a fake __file__ in
  via AnsibleModule).

* Rename the name of the AnsiBallZ wrapped module
  This makes it obvious that the wrapped module isn't the module file that
  we distribute.  It's part of trying to mitigate the fact that the module
  is now named __main)).py in tracebacks.

* Shield all wrapper symbols inside of a function
  With the new import code, all symbols in the wrapper become visible in
  the module.  To mitigate the chance of collisions, move most symbols
  into a toplevel function.  The only symbols left in the global namespace
  are now _ANSIBALLZ_WRAPPER and _ansiballz_main.

revised porting guide entry

Integrate code coverage collection into AnsiballZ.

ci_coverage
ci_complete
2018-07-26 20:07:25 -07:00
Richard Schwab
ec20d4b13e Enable zone detection in nsupdate (#41365)
Fixes #41346
2018-07-26 23:06:47 -04:00
John R Barker
3ab9030f05 Document more tools (#43053)
* Document more tools
2018-07-26 17:23:00 -05:00
Zim Kalinowski
30ef83c1c0 fixing bug in storage account sample (#43308) 2018-07-26 17:20:20 -04:00
Yanis Guenane
d94cc3568a CloudStack: Fix typos in the Guide (#43303) 2018-07-26 16:08:32 -04:00
Zim Kalinowski
e43d4ac512 fixing mysql server sample (#43300) 2018-07-26 16:07:37 -04:00
Zim Kalinowski
3f9cacf777 fixed postgresql server sample (#43299) 2018-07-26 16:07:07 -04:00
Yuma Inaura (稲浦悠馬)
1199dff246 Update porting_guide_2.0.rst
Fix indent

+label: docsite_pr
2018-07-26 14:59:43 -04:00
Nilashish Chakraborty
18235af363
Fix baud rate and nxos_logging default case idempotency bug (#43295)
* Fix baud rate and idempotency bug

* Fix Shippable errors

* Combine commands calls

* Fix Shippable errors II
2018-07-26 23:15:25 +05:30
Dag Wieers
1ab411229a Get rid of duplicate status statement (#42885)
If a module was in status "preview", but it was not "supported"
(core/network) the message about the module being "preview" would be
repeated.
2018-07-26 11:32:49 -05:00
Nathan Hyde
d3230b9172 Correct link to Getting Started with Docker Guide (#42709)
Update link to the docker getting started guide.

+label: docsite_pr
2018-07-26 10:39:01 -05:00
Nathaniel Case
ab40c72a3c
httpapi: Split off and save response text contents (#43305)
* Split off and save response text contents

* login might depend on httpapi
2018-07-26 10:12:34 -04:00
Abhijeet Kasurde
13dd1acbec Fix typo in ignore_unknown_extensions doc
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2018-07-26 09:28:33 -04:00
Blair Rampling
7a35e2f8c1 adds naptr record module (#39383)
* adds naptr record module

* fixes pep8

* fixes doc errors
2018-07-26 15:45:03 +05:30
Ganesh Nalawade
5e44189a36
Update junos_netconf module documentation (#43291)
Fixes #42719

* Add module documentation to reflect that when netconf
  port is not mentioned the module by default enables
  netconf on port 830 only.
2018-07-26 10:52:25 +05:30
Ganesh Nalawade
a9b6d19abb
Add botmeta entry for ansible-connection (#43290) 2018-07-26 10:11:13 +05:30
Matt Clay
72f1a6cc1f Fix bug preventing coverage of setup module. 2018-07-25 19:11:48 -07:00
Dag Wieers
32b5992578 uri: Avoid false traceback in common scenarios (#39526)
* uri: Avoid exception in common scenario

So I was confused by the fact that the **uri** module, when not
returning an acceptable HTTP status code, returns:

    The full traceback is:
      File "/tmp/ansible_UQwiI4/ansible_module_uri.py", line 471, in main
        uresp['location'] = absolute_location(url, uresp['location'])

While the actual error was:

    Status code was 400 and not [201]: HTTP Error 400:

I also wonder why that message ends abruptly. I would have expected
`HTTP Error 400: Bad Request` which would be more useful.

* uri: Avoid false positive tracebacks in fail_json() on PY2
2018-07-25 18:17:44 -07:00
Toshio Kuratomi
6eacfecb73 ANSIBLE_REMOTE_TMP was an implementation of unified temp that was later changed
One of the earlier implementation of unified temp for 2.4 passed the
temp diretory to the remote side using this environment variable.  We
later changed it to be passed via a module parameter but forgot to
remove the environment variable.
2018-07-25 16:57:46 -07:00
Adam Miller
66b1adfc83 fix fedora version dnf fact, default pkg_mgr detection per distro family (#43261)
* fix fedora version dnf fact, default pkg_mgr detection per distro family
* loop over possible dnf/yum paths in case there are multiple canonical sources later in life

Signed-off-by: Adam Miller <admiller@redhat.com>
2018-07-25 16:20:07 -07:00
John Jensen
7ba0d8f60e fix regex parse for total memory in slxos_facts.py (#43258)
* fix regex parse for total memory in slxos_facts.py

* account for one or no spaces per LindsayHill's suggestion
2018-07-25 16:59:23 -04:00
Sam Doran
2a1a8585f3
Add reboot module stuff to 2.7 roadmap (#43232) 2018-07-25 16:37:57 -04:00
Fabian von Feilitzsch
d27de6acd9 Add from_yaml_all to support multi document yaml strings (#43037)
* Support multi-doc yaml in the from_yaml filter

* Most automatic method of handling multidoc

* Only use safe_load_all

* Implement separate filter

* Update plugin docs and changelog
2018-07-25 16:12:22 -04:00
Julien Champseix
19dc267e4c Allow specifying the output encoding in the template module (#42171)
Allow specifying the source and destination files' encodings in the template module

* Added output_encoding to the template module, default to utf-8
* Added documentation for the new variables
* Leveraged the encoding argument on to_text() and to_bytes() to keep the implementation as simple as possible
* Added integration tests with files in utf-8 and windows-1252 encodings, testing all combinations
* fix bad smell test by excluding windows-1252 files from the utf8 checks
* fix bad smell test by excluding valid files from the smart quote test
2018-07-25 13:10:40 -07:00
Toshio Kuratomi
5b4a7cc283 Fix journald unittests
d7df072b96 changed how we call
journal.send() from positional arguments to keyword arguments.  So we
need to update the test to check for the arguments it was called with in
the keyword args, not in the positional args.
2018-07-25 11:20:24 -07:00
Andrew Gaffney
dbff49dee0
Remove dead 'vault_password' play attribute (#41847) 2018-07-25 12:01:10 -05:00
Dag Wieers
9bf22309b3 Clarify uncertain nature of tracebacks on Python 2 (#42513)
* Only add exception/traceback on Python 3

On Python 2 the traceback could be any exception from the stack frame
and likely unrelated to the fail_json call.

On Python 3 the traceback is cleared outside any exception frame, so the
call always returns the most inner traceback (if any), and therefor is
most likely related to the fail_json call.

* Add uncertainty to traceback on Python 2

On Python 2 the last exception in the stack frame is being returned,
this could be unrelated to the actual error, especially if fail_json()
is called outside an except: block.
2018-07-25 11:49:16 -04:00
curry9999
1305fca414 change version_added cobbler_sync (#43248) 2018-07-25 14:38:36 +02:00
saichint
fa5f396a4b nxos_file_copy enhancement (#42424)
* add file_pull option

* typo correction

* fix shippable error

* review comments

* fix for review comments by mwiebe

* possible shippable fix

* remove file_copy from ignore

* more review comments addressed

* review comments

* add localhost for remote scp server in tests

* timeout fix
2018-07-25 17:46:55 +05:30
mjmayer
a488b3a8ed elb_application_lb purge rules option (#43113)
* Add parameter to keep elb rules

Does not purge elb rules. This is usefull if running the elb_application_lb
 role and there is the desire to keep existing rules.

* Change variable name keep_rules to purge_rules

The descriptor purge has been used in the past.

* Changed default for purge_rules

Default is purge_rules. This is how the module has functioned previously. This change maintains
 the previous behavior.

* Add integration test for purge_rules flag

* Change wording of test task

* Fix merge conflcit

* Changed default for purge_rules

Default is purge_rules. This is how the module has functioned previously. This change maintains
 the previous behavior.

* merge conflcit

* Change wording of test task

* Add purge_rules option to test

* Change test description wording

* Expand purge_rules documentation

* Clarifies documentation for purge_rules option
2018-07-25 20:55:34 +10:00
Fran Garcia
577306e74b Fix #42000 : ovirt_host_pm documentation for slot parameter (#42196)
* Fix for #42000: ovirt_host_pm ignores slot parameter

* Fix for #42000: ovirt_host_pm ignores slot parameter

* Remove non-required slot parameter
2018-07-25 05:19:24 -04:00
Jordan Borean
2c9cbae3f9
Removed deprecated Windows items slated for removed in 2.7 (#43231) 2018-07-25 12:02:49 +10:00
tomelrod
5eb47066e3 Documentation change for resizefs (#43224)
* Documentation change for resizefs

Changed documentation to match the default value of resizefs set in the code.
Added a note on the resizefs use on the example utilizing it.

* Remove test now it validates fine
2018-07-25 00:22:24 +02:00
Adam Miller
85fedf9fcf
make sure to get correct python version for rpmfluff in setup_rpm_repo (#43228)
* make sure to get correct python version for rpmfluff in setup_rpm_repo

Signed-off-by: Adam Miller <admiller@redhat.com>
2018-07-24 17:17:51 -05:00
Dag Wieers
939de473c6
Add a 'finished' test for async jobs (#38325)
This provides a more convenient way for testing (async) jobs.

When used with a non-async job it will report a warning so the user is
aware that he may be doing something incorrect.

Since the 'finished' result value is an integer (!), the test is turning
this in a proper boolean.
2018-07-24 23:21:28 +02:00
Dag Wieers
5ecfb0b793 cobbler_system: New module to manage Cobbler systems (#39913)
* cobbler_system: New module to manage Cobbler systems

This module is useful to provision new systems using Cobbler and Ansible.

* cobbler_system: warn on invalid properties
2018-07-24 15:50:20 -04:00
Andrew Gaffney
42346937b1
Display task banner before item status (#42892)
This is a follow-up to #41058
2018-07-24 12:25:28 -05:00
Brian Coca
917b6b0d09 import_playbook is not usable from inside a play
(cherry picked from commit 55dddf530ad094810929823f80c4546e97a69ac7)
2018-07-24 13:25:12 -04:00
Nathaniel Case
a7097f6735
Try to enable more exotic auth methods in httpapi (#43212)
* Try to enable more exotic auth methods in httpapi

* Auth tokens won't always come back.

* Reconcile #43147 with this PR
2018-07-24 13:22:40 -04:00
Brian Coca
ac1f05478e Allow to specifically customize console's color 2018-07-24 13:21:58 -04:00
Xyon
3bb9f689e9 Fix spelling; summery -> summary (#43213)
Fix the incorrect spelling of "summary".
2018-07-24 22:10:48 +05:30
Rémy Léone
3113c68053 Fix author name in the documentation 2018-07-24 12:01:37 -04:00
Toshio Kuratomi
09142f791c Change the schedule to allow slip time.
We have to have time to slip release in case of major bugs.
2018-07-24 08:54:26 -07:00