Commit graph

18 commits

Author SHA1 Message Date
Sviatoslav Sydorenko
20bb915092
Refactor Python API examples and docs
PR : it's a follow-up for .

It includes a merge of `examples/scripts/uptime.py` and a similar
code snippet from `docs/docsite/rst/dev_guide/developing_api.rst`.

This patch also changes the docs RST file to include contents of
the example file instead of holding a copy of a similar code.
2020-07-23 18:24:02 +02:00
Sviatoslav Sydorenko
8d97c8c222 Fix the internal Python API usage examples
Previous version initialized the `TaskQueueManager` after calling
`Play.load()` while advertising a way to inject a custom library
location path. This caused the tasks loader not to find any custom
modules because it was triggered before the path was actually added
to the module loader.

This patch changes the order of the operations to ensure that the
customized `context.CLIARGS` actually influences things.

Resolves https://github.com/ansible/ansible/issues/69758.
2020-07-03 10:44:54 +02:00
Matt Clay
4816bb4f43
More boilerplate fixes. ()
* Fix boilerplate in hacking dir.
* Fix boilerplate in docs dir.
* Fix boilerplate in integration tests.
* Fix boilerplate in examples.
2020-06-22 19:05:30 -07:00
Abhijeet Kasurde
1da5e21289 examples: fix Ansible API example ()
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-02-12 15:35:49 -06:00
Joren Vrancken
b954917761 Surround top-level function and class definitions with two blank lines. 2018-07-31 12:06:56 -07:00
John Bond
d72587084b Update example uptime script to provide correct type for explicit individual hosts () 2018-01-16 11:39:15 -06:00
Matt Clay
797664d9cb Python 2.6 str.format() compatibility fixes. 2018-01-10 14:08:11 -08:00
Matt Martz
2b08e00a54 Update uptime.py example script with changes to the API. Fixes 2017-10-04 08:50:10 -07:00
Toshio Kuratomi
87a192fe66 Fix one name in module error due to rewritten VariableManager 2017-07-27 15:37:26 -07:00
Dag Wieers
ea27baf7ff examples/: PEP8 compliancy ()
- Make PEP8 compliant
2017-05-18 08:38:40 +01:00
Matt Clay
10d9318de7 PEP 8 indent cleanup. ()
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
2017-01-29 07:28:53 +00:00
TaoBeier
6ec0369c26 fix indent () 2017-01-10 18:47:03 -08:00
Matt Clay
75c281debc Fix compile errors in scripts. 2016-12-08 11:35:20 -05:00
Matt Clay
0d46805979 Clean up shebangs for various files.
- Remove shebangs from:
  - ini files
  - unit tests
  - module_utils
  - plugins
  - module_docs_fragments
  - non-executable Makefiles
- Change non-modules from '/usr/bin/python' to '/usr/bin/env python'.
- Change '/bin/env' to '/usr/bin/env'.

Also removed main functions from unit tests (since they no longer
have a shebang) and fixed a python 3 compatibility issue with
update_bundled.py so it does not need to specify a python 2 shebang.

A script was added to check for unexpected shebangs in files.
This script is run during CI on Shippable.
2016-11-02 17:00:27 -07:00
Shota
47f715fb37 Fix some typos () 2016-06-29 14:31:25 -04:00
b4ldr
439baf004e update uptime script to use version 2.0 of the api 2016-02-17 18:34:12 +00:00
Michael DeHaan
9fa014f76d Fix uptime example in examples/scripts 2012-08-24 19:32:24 -04:00
Michael DeHaan
2e1b59a9d2 restructure the examples directory 2012-03-13 19:27:13 -04:00
Renamed from examples/uptime.py (Browse further)