Commit Graph

1052 Commits (4961f003e577d57c67a6fd0bd9904a7b5f3a1fbf)

Author SHA1 Message Date
Andrew Gaffney fdabfb6821 Update junos docs fragment to note the default port for transport=netconf 2016-08-13 14:52:06 +00:00
John R Barker b82d150c42 Add missing version_added (#17050)
A number of new arguments were added in
637bbdadfa (diff-60710cdc60751ecd19968b01b98283a0)
but not documented
2016-08-11 12:58:11 -04:00
Brian Coca eb0c90ab80 added unsafe_writes as common file feature (#17016) 2016-08-09 12:39:17 -04:00
Tim Rupp 5f34206b0a Adds module doc fragment for F5 modules
To reduce documentation duplication, this module fragment is
being created for use in all F5 modules.
2016-08-05 12:21:46 -07:00
Toshio Kuratomi 1ecf51d87e * Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
    the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
  tildes in environment variables will be handled.
2016-08-04 19:35:36 -04:00
James Cammarata 159aa26b36 FEATURE: adding variable serial batches
This feature changes the scalar value of `serial:` to a list, which
allows users to specify a list of values, so batches can be ramped
up (commonly called "canary" setups):

- hosts: all
  serial: [1, 5, 10, "100%"]
  tasks:
  ...
2016-08-04 15:04:10 -05:00
Alexandre Garnier ba2d1d0bc4 Colorize around text (#16415)
Avoid to colorize separately `lead`, equals sign and `num` and separate
them by coloring characters.
2016-07-23 18:09:20 -04:00
Peter Sprygada 637bbdadfa add new features to ios shared module
* add load_config() for loading a set of configuration commands
* add load_candidate() function for loading a candidate config
* updates shared module to provide NetworKModule instead of get_module
* fixes Cli transport implementation for 2.2 refactor
* updates ios documentation fragments with new options
2016-07-11 05:57:15 -07:00
Peter Sprygada 54199f1cfb initial add of vyos shared documentation fragments 2016-07-04 22:58:00 -04:00
chouseknecht a076612b63 Update and pin to azure-2.0.0rc5 2016-07-02 18:16:43 -04:00
Brian Coca 3afe50dfe2 push unicode handling into unfrack 2016-06-28 10:57:41 -04:00
Brian Coca bae988ee9b fix path utils 2016-06-28 10:38:34 -04:00
Peter Sprygada d83962d3f5 Merge pull request #15992 from ogenstad/asa
Module util, template action and doc fragment for Cisco ASA
2016-06-27 06:32:12 -07:00
art-at-sky 38590fbab9 Fix string coercion problem in error handling code 10:50 (#16270)
Manifests as the following stack trace
  File "/usr/local/Cellar/ansible/2.0.1.0/libexec/lib/python2.7/site-packages/ansible/utils/display.py", line 259, in error
      new_msg = u"ERROR! " + msg
      TypeError: coercing to Unicode: need string or buffer, AnsibleParserError found
2016-06-17 12:02:01 -07:00
vlna 53ac89e40d Typo fix: Kuraotmi -> Kuratomi 2016-06-06 15:24:44 +02:00
nitzmahone 434c949d03 update azure minimum doc fragment 2016-06-04 16:05:58 -07:00
Bede Carroll 805e0ec529 Add validate_certs to vmware doc fragment (#16096) 2016-06-02 10:21:39 -04:00
ogenstad 6027e5b580 Module util, template action and doc fragment for Cisco ASA 2016-06-01 20:57:30 +02:00
Brian Coca 38cca53669 return friendlier error when failing to make dirs 2016-05-20 09:03:01 -04:00
René Moser ff62d7bbbd docs: cloudstack: add cloudstack guide to doc fragments (#15898) 2016-05-19 10:31:44 +02:00
Jiri Tyr 589f6d25bb Updating VCA module documentation (#14368) 2016-05-06 09:53:43 -04:00
Chris Houseknecht 361ee9d7a6 Merge pull request #15618 from chouseknecht/docker_doc_frag
Docker doc frag
2016-04-29 01:27:57 -04:00
Brian Coca 60c1155d50 added common azure tags fragment 2016-04-27 16:55:41 -04:00
chouseknecht 9ddcf13661
Add aliases 2016-04-27 04:12:47 -04:00
chouseknecht 2e19a1d86a
Updated doc fragment to be consistent with the getting started guide. 2016-04-27 04:02:15 -04:00
Jonathan Davila f296d74329 Documentation fragment. To be used with modules that use basic auth. (#15582)
Supplies a doc fragment for:
- api_username
- api_password
- api_url
- validate_certs
2016-04-25 12:54:11 -04:00
Darragh Bailey be17ba67b2 Prevent race in key setup for accelerate daemon (#15299)
Ensure that initial setup in creating the key directory for ansible
accelerate mode keys, and generation/storage of the key for a
particular host are completed in a multiprocess safe manner.

Creating directories/files and then assigning permissions and contents
to them means that paths may exist and satisfy the os.path.exists()
method in python for other processes before they are usable.

Use a combination of locking around operations with use of unique named
files and an OS file system move to ensure that the conditions of
checking whether a file or directory exists, where it is potentially
created by another thread, will only succeed when the file has both the
correct contents and permissions.

Fixes #13850
2016-04-25 12:13:42 -04:00
Brian Coca 0f9eaedfa9 added missing alias to docker doc fragment 2016-04-25 10:20:59 -04:00
Chris Houseknecht ba74f5f3e5 Adding docker doc frag (#15494) 2016-04-20 13:56:19 -04:00
Chris Houseknecht f28a0ca4bb Update Azure doc fragment (#15450)
* Add default attribute to all option doc strings.

* Fix fragment file name.
2016-04-18 11:05:30 -04:00
chouseknecht 98d8da1e67 Adding Azure module doc fragments. 2016-04-16 01:19:59 -04:00
Patrick Ogenstad 6c5ea685a2 Allow timeout to be configurable (#14973) 2016-04-14 09:35:07 -04:00
Nathaniel Case 7290b6282d Update IOS, IOSXR, JUNOS, & OpenSwitch for environment vars. 2016-04-12 08:55:15 -04:00
Nathaniel Case dbc49ad95b First implementation of 'fallback' parameter
Implemented & documented for EOS & NXOS
2016-04-12 08:55:15 -04:00
Toshio Kuratomi b27c424fa1 Fixes to the documentation build (#15356)
* Could only have one alias before.  Subsequent aliases overrode the
  previous ones.  Now multiple aliases work.
* Fix BLACKLISTED_MODULES.   Previously, modules were listed in the
  generated documentation despite being blacklisted
* Deprecated modules form extras were showing the (E) tag and not the
  (D) tag. Reversed that now (Probably not necessary to also show the
  E tag).
* Sort the deprecated modules alphabetically in the Category docs as
  well as the list of all modules
* Optimization: Previously rendered the modules to rst twice once in all
  group and once in individual categories.  Fixed to only render them
  once.
* Add fireball to blacklist and remove async_status (as people need to
  use that).
2016-04-11 17:11:55 -07:00
Brian Coca 005dc84aa7 moved last utils.debug to display.debug 2016-04-08 16:00:36 -04:00
Brian Coca 0eb2844cc6 moved display's debug lock to cli as global 2016-04-08 13:08:24 -04:00
Strahinja Kustudić eed6cf5dad Adds 'ansible_check_mode' boolean magic variable
* Makes it possible to pass any options variable to VariableManager
  by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
2016-04-08 00:26:02 +02:00
Nathaniel Case e4e913b331 Override params from environment variables, if set.
Fix a typo while I'm in the area.

Handle having None set in module.params more intelligently
2016-03-30 17:28:30 -04:00
David Wittman 5036d1742c Fix boolean choices in module docs fragments
A few of the docs fragments have the available choices for some params
defined as "BOOLEANS". Because choices accepts a list, it treats
"BOOLEANS" as an iterable and then generates a list composed of each
letter.

Instead, define the available choices as a list of `['yes', 'no']`,
as is common in most other modules.
2016-03-27 15:30:27 -05:00
James Cammarata e4a5bcae3c Merge pull request #14679 from dagwieers/merge_hash_v2
Avoid merging a dict and a AnsibleUnicode
2016-03-19 12:58:42 -04:00
Matt Clay 6a1f97ad42 Add docs for mysql* modules connect_timeout. 2016-03-16 22:31:48 -07:00
Matt Clay 1e1852c34d Add missing to_bytes on directory path. 2016-03-11 16:55:51 -08:00
Brian Coca 325fccfa78 added v for least verbose display function 2016-03-07 13:17:31 -05:00
Matt Clay 5b79ed77e7 Use to_bytes on filenames in filesystem calls. 2016-03-04 09:08:41 -08:00
Brian Coca 347aa7b032 Merge pull request #14774 from lamby/ignore-epipe-when-flushing-stdout-stderr
Ignore EPIPE when flushing stdout stderr
2016-03-03 14:26:20 -05:00
Chris Lamb eb1141ee79 Ignore EPIPE to avoid tracebacks when piping output to other commands
For example:

  $ ansible web --list-hosts | head -n1
  hosts (7):
  ERROR! Unexpected Exception: [Errno 32] Broken pipe
  Traceback (most recent call last):
    File "/home/lamby/git/private/lamby-ansible2/.venv/bin/ansible", line 114, in <module>
      display.display("to see the full traceback, use -vvv")
    File "/home/lamby/git/private/lamby-ansible2/.venv/local/lib/python2.7/site-packages/ansible/utils/display.py", line 133, in display
      sys.stdout.flush()
  IOError: [Errno 32] Broken pipe

Such a pipe target will close up shop early when its seen enough input,
causing ansible to print an ugly traceback.

Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
2016-03-03 19:21:06 +00:00
Chris Lamb 951c8a5d27 Alias fileobj. 2016-03-03 19:16:58 +00:00
Brian Coca 0031a72e0d tweak deprecation warnings display 2016-03-03 13:51:44 -05:00
Dag Wieers 0eca47cf91 Avoid merging a dict and a AnsibleUnicode
This is the same fix we applied to v1.9 in PR #14565, however it does not fix #14678 completely !
The dictionaries are not being merged as tey are on v1.9.
2016-02-26 15:03:51 +01:00
Dag Wieers 5a57139d91 Improve efficiency of merge_hash
This is related to #14559, but only the part for Ansible v2.0

This commit makes merging empty dicts, or equal dicts more efficient.

I noticed that while debugging merge_hash a lot of merges related to empty dictionaries and sometimes also identical dictionaries.
2016-02-18 16:03:11 +01:00
Brian Coca 6ddea3e915 removed follow from common file docs 2016-02-15 14:13:20 -05:00
Brian Coca dc6f0c1290 avoid logging color codes 2016-02-03 10:55:30 -05:00
Toshio Kuratomi fa9822df0f Changes to convert to unicode at the borders
The module docs and vault changes solve issues where tracebacks can
happen.  The galaxy changes are mostly refactoring to be more pythonic
with a small chance that a unicode traceback could have occurred there
without the changes.  The change in __init__.py when we actually call
the pager makes things more robust but could hide places where we had
bytes coming in already so I didn't want to change that without auditing
where the text was coming from.

Fixes #14178
2016-01-28 10:56:46 -08:00
Brian Coca c857b20043 fixed issue with vars prompt warning causing error
sometimes display object is not magically available, use it explicitly,
no need to be classmethod anymore
fixes #14147
2016-01-27 16:13:06 -05:00
Brian Coca 66104191d1 fixed permissions check for ansible.log
fixes #13990
2016-01-26 11:22:52 -05:00
Peter Sprygada 981265ac84 adds provider argument to nxos shared module
The provider argument accepts the set of device common arguments as a
dict object.  Individual connection arguments can still be included and
take priority over the provider argument.  This update includes additions
to the nxos doc fragment
2016-01-19 19:02:41 -05:00
Peter Sprygada 9cba1a7c69 adds provider argument to ios shared module
New argument `provider` added to the ios shared module that provides
the ability to pass all of the common ios arguments as a dict.  This commit
includes some minor bugfixes and refactoring of names.   It also includes
udpates to the ios documentation fragment for the new argument
2016-01-19 19:00:52 -05:00
Peter Sprygada e2ff26a5cf add provider argument to eos shared module
Adds a new argument `provider` to the eos shared module and updates the
eos doc fragment.  This commit includes some additional minor fixes and
code refactors for naming conventions.  The `provider` argument allows the
shared module arguments to be passed as a dict object instead of having
to pass each argument invididually.
2016-01-19 18:57:26 -05:00
Peter Sprygada 0f2917fde3 add provider to iosxr shared module
This commit adds a new argument `provider` to the iosxr shared module that
allows common connection parameters to be passed as a dict object.  The
constraints on the args still applies.  This commit also updates the iosxr
doc fragment.
2016-01-19 14:51:06 -05:00
Peter Sprygada 7640eca368 adds provider argument to openswitch shared module
Adds new argument `provider` to the openswitch shared module.  The provider
argument can pass all openswitch connection arguments as a dict object.  This
update includes adding the provider argument to the openswitch doc fragment
2016-01-19 14:50:39 -05:00
Peter Sprygada 33d390fb58 adds provider argument to junos shared module
This commit adds a new argument `provider` to the junos shared module.  The
argument allows the set of common connection args to be passed to the
junos shared module.  This commit also updates the junos doc fragment
2016-01-19 14:50:01 -05:00
James Cammarata b1223746cd Relocate use of ERROR to display class, to avoid doubling up 2016-01-19 12:10:39 -05:00
Brian Coca 27f4730c29 correctly deals with non serializable type
combine_vars shoudl really be data types, but some just get in
in test, add dict to mock and avoid combine_vars using object
2016-01-18 15:17:43 -05:00
Chrrrles Paul 3f66f58fde Merge pull request #13819 from chrrrles/vmware_doc_fragments
doc fragments for vmware and vca modules
2016-01-15 15:42:43 -06:00
Brian Coca 9d1b280689 now combine vars errors dump vars
very hard to debug w/o knowing what vars were being merged at the time of the error
2016-01-14 10:23:35 -05:00
Toshio Kuratomi 58f387a6dd Fix circular import 2016-01-13 14:04:56 -08:00
Toshio Kuratomi 8068f23bad do_encrypt import needed to move as well
Fixes #13861
2016-01-13 13:08:33 -08:00
Charles Paul 9f9bff88c2 doc fragments for vmware_ vca_ 2016-01-12 11:06:22 -06:00
Robin Roth e01ff3b352 remove unused imports
clean up imports of time.sleep and stat that are no (longer) used here
2016-01-11 14:14:20 +01:00
Peter Sprygada b7fec945be Merge pull request #13788 from privateip/shared_module_junos
initial add of junos shared module
2016-01-10 14:39:37 -05:00
Peter Sprygada 60e0e1a12e Merge pull request #13784 from privateip/shared_module_openswitch
initial add of openswitch shared module
2016-01-10 14:35:42 -05:00
Peter Sprygada 771d8014fc Merge pull request #13779 from privateip/shared_module_nxos
adds shared module nxos for building cisco nxos modules
2016-01-10 14:32:23 -05:00
Peter Sprygada a0a4edd494 Merge pull request #13777 from privateip/shared_module_ios
updates the ios shared module with new shell
2016-01-10 14:28:00 -05:00
Peter Sprygada a648097285 Merge pull request #13778 from privateip/shared_module_iosxr
adds new iosxr shared module for developing modules that work with IO…
2016-01-10 14:23:22 -05:00
Peter Sprygada 41fed323bc Merge pull request #13776 from privateip/shared_module_eos
initial add of eos shared module
2016-01-10 14:19:31 -05:00
Peter Sprygada e709095f53 initial add of junos shared module
This commit adds a new shared module for working with network devices running
the Juniper Junos operating system.  The commit includes a new document
fragment junos to be used when building modules.  The junos shared module
currently only supports CLI
2016-01-10 10:36:44 -05:00
Peter Sprygada 3ae6fd4b31 initial add of openswitch shared module
This commit adds a new shared module openswitch for building modules that
work with OpenSwitch.  This shared module supports connectivity to
OpenSwitch devices over SSH, CLI or REST.  It also adds an openswitch
documentation fragment for use in modules
2016-01-09 10:38:48 -05:00
Peter Sprygada 01a99f52a9 adds shared module nxos for building cisco nxos modules
This commit refactors the nxapi into a new shared module nxos that supports
connectivity over both ssh (cli) and nxapi.  It supercedes the nxapi shared
module and removes it from module_utils.  This commit also adds a
documentation fragement supporting the nxos shared module
2016-01-09 09:10:02 -05:00
Brian Coca c9a5f7ea7e updated self to cls to match convention
tempted to just use this. in all cases
2016-01-08 17:57:09 -05:00
Peter Sprygada 456b3d2c23 adds new iosxr shared module for developing modules that work with IOS XR devices
This commit adds a new shared module for working with Cisco IOS XR devices over
CLI (SSH).  It also provides a documentation fragement for the commmon arguments
provided by the iosxr module.
2016-01-08 14:14:29 -05:00
Peter Sprygada d1dacfb3ca updates the ios shared module with new shell
This update refactor the ios shared module to use the new shell shared
library instead of issh and cli.  It also adds the ios documentation
fragment to be used when building ios based modules.
2016-01-08 14:14:08 -05:00
Peter Sprygada 87ccc5c869 initial add of eos shared module
This adds a shared module for communicating with Arista EOS devices over
SSH (cli) or JSON-RPC (eapi).  This modules replaces the eapi.py module
previously added to module_utils.  This commit includes a documentation
fragment that describes the eos common arguments
2016-01-08 14:13:48 -05:00
Brian Coca 1cc5ac06e7 restructure vars_prompt and fix regression
pushed it to use the existing propmpt from display and moved the vars prompt code there also for uniformity
changed vars_prompt to check extra vars vs the empty play.vars to restore 1.9 behaviour
sipmlified the code as it didn't need to check for syntax again (tqm is made none prior based on that)
fixes #13770
2016-01-08 11:46:04 -05:00
Brian Coca 737090dd13 now show full callback stacktrace when vvv+
Still is a warning as we don't want to repeat it multiple times nor additional callbacks to stop ansible execution.
hopefully we can avoid shipping w/o exceptions in the default/minimal callbacks...

Also added feature that now allows for 'preformated' strings passed to warning
2016-01-08 10:42:12 -05:00
Abhijit Menon-Sen 7c8374e0f8 Strip string terms before templating
The earlier code did call terms.strip(), but ignored the return value
instead of passing that in to templar.template(). Clearly an oversight.
2016-01-06 20:44:19 +05:30
Brian Coca 095790ac5c Merge pull request #13691 from bcoca/colors
output color is now configurable
2016-01-05 14:33:01 -05:00
Thilo Uttendorfer 5c34be15b1 Fix unsupported format character 2015-12-31 02:31:38 +01:00
Brian Coca d3deb24ead output color is now configurable 2015-12-29 17:40:47 -05:00
James Cammarata e546219426 Revert "Enable host_key checking at the strategy level"
This reverts commit 1a6d660d7e285cceec474952a33af4d8dffd0a8d.
2015-12-17 12:43:47 -05:00
James Cammarata e5c2c03dea Enable host_key checking at the strategy level
Implements a new method in the ssh connection plugin (fetch_and_store_key)
which is used to prefetch the key using ssh-keyscan.
2015-12-16 21:41:07 -05:00
Jonathan Mainguy 34e88e48a5 Add shared connection code for mysql modules 2015-12-16 13:36:18 -05:00
Toshio Kuratomi 62979efa14 Finish up plugin porting to global display
Also remove display = display which does nothing
2015-11-11 10:44:23 -08:00
James Cammarata 86de1429e5 Cleaning up FIXMEs 2015-10-22 16:03:50 -04:00
Brian Coca 04aa7701d1 fix prompt, static methods don't get 'self'
fixes #12833
2015-10-21 12:06:29 -04:00
Toshio Kuratomi f34b55ac2b Add python3-compat boilerplate to all .py files in lib/ansible 2015-10-19 18:36:19 -07:00
Brian Coca de3ca57a33 avoid relative shlex import
fixes #12777
2015-10-19 19:55:22 -04:00
Toshio Kuratomi 3da8bab3ff Cleanup pyflakes warning (real error) 2015-10-19 11:29:51 -07:00
Toshio Kuratomi b67e51ea06 Information on when to use to_str() and what a native string is 2015-10-19 09:28:43 -07:00
Brian Coca 71ffb86c30 don't let cowsay issues stop execution
fixes #12773
2015-10-16 15:20:59 -04:00
Toshio Kuratomi baa309309d Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version. 2015-10-16 08:21:28 -07:00
James Cammarata dce58a78c9 Make random cowsay truly random
Also adds a cowsay whitelist config option, because there are some
truly NSFW stencils that come with cowsay by default.
2015-10-15 10:52:53 -04:00
Marius Gedminas ab569cea22 Move to_str alias into ansible.utils.unicode
@abadger suggested on IRC that it's useful enough to go into
ansible.utils.unicode.
2015-10-15 10:27:38 +03:00
Toshio Kuratomi b441bcb678 Fix display when run through a testing framework that overrides stderr/stdout 2015-10-12 10:06:13 -07:00
Toshio Kuratomi d1b98ec776 Correct typo 2015-10-08 08:44:25 -07:00
Toshio Kuratomi 2f5e817007 Do not mix byte str with unicode type 2015-10-08 08:31:12 -07:00
Toshio Kuratomi 01ba2e94c0 Wait until later to convert to byte strings for output
Also some pre-emptive python3 compat and a code simplification
2015-10-08 08:22:17 -07:00
Brian Coca 4463ced8ba simpler safe output 2015-10-08 10:15:48 -04:00
Brian Coca d8769c93c7 updated ec2 region description to add missing other env var 2015-10-07 16:41:58 -04:00
Brian Coca c77733e64e added docs for commonly used region parameter in some ec2 modules 2015-10-07 15:52:06 -04:00
Brian Coca f73329401b galaxy updates
better error reporting on fetching errors
use scm if it exists over src
unified functions in requirements
simplified logic
added verbose to tests
cleanup code refs, unused options and dead code
moved get_opt to base class
fixes #11920
fixes #12612
fixes #10454
2015-10-05 11:43:08 -04:00
James Cammarata aa3687d736 Fix syntax error for octal in encrypt methods 2015-10-02 02:27:57 -04:00
James Cammarata 8ef78b1cf8 Fixing accelerated connection plugin 2015-10-02 00:50:02 -04:00
soarpenguin 1ea66e234f fix logic judgment error. 2015-09-26 15:15:53 +08:00
soarpenguin 2caa52a981 fix no self pointer out of class. 2015-09-26 14:09:56 +08:00
Marius Gedminas 5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
2015-09-24 12:36:05 +03:00
James Cammarata cc6627cdd6 Remove custom json encoder cleaner and strip proxy var stuff out before encoding
Fixes #12349
2015-09-17 16:04:47 -04:00
James Cammarata 5db9e38377 Merge pull request #12345 from mgedmin/py3k
Python 3: two more instances of 'basestring'
2015-09-16 16:49:46 -04:00
Andriy Yurchuk af213241ab Fix typo 2015-09-14 21:11:40 +02:00
Marius Gedminas 9877a5c415 Python 3: two more instances of 'basestring'
Fixes two failing tests on Python 3.4.
2015-09-14 08:27:39 +03:00
James Cammarata 30399edada Use UnsafeProxy for lookup results too
Also fixes a couple of bugs that popped up when using the proxy class
2015-09-08 12:19:39 -04:00
James Cammarata ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
2015-09-04 16:41:38 -04:00
Toshio Kuratomi aeff960d02 Cleanup combine_vars
* Dedupe combine_vars() code (removed from VariableManager)
* Fix merge_hash algorithm to preserve the type
* unittest combine_vars and merge_hash
2015-09-01 11:23:12 -07:00
Marius Gedminas 54dbfba8f8 Make combine_vars() compatible with Python 3
Fixes

  TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'

on Python 3.
2015-09-01 09:39:59 +03:00
James Cammarata 2043fcd5db Merge pull request #12083 from resmo/for-ansible
cloudstack: implement general api_region support, update docs
2015-08-28 13:14:50 -04:00
James Cammarata 5a5b9f211b Validate variable names when loading 'vars:' blocks
TODO: add this to VariableManager to validate vars loaded from files too

Fixes #12022
2015-08-28 11:36:31 -04:00
Marius Gedminas eb99aa8c68 Fix to_bytes(None) on Python 3
You cannot call bytes(obj) to get a simple representation of obj on
Python 3!  E.g. bytes(42) returns a byte string with 42 NUL characters
instead of b'42'.
2015-08-27 22:15:56 +03:00
Marius Gedminas da1e611b26 Support print as a function
I neglected the __future__ import because

  print(one_thing)

works the same way even when print is a statement.
2015-08-27 22:15:56 +03:00
Marius Gedminas 0c6ce31f76 Use 'except ... as' syntax
This syntax works on Python 2.6 through 3.x.  lib/ansible/module_utils
(and lib/ansible/modules) need to support Python 2.4, so I didn't touch
those.
2015-08-27 22:15:04 +03:00
Brian Coca 2ac931d6c9 ported module_docs to use display 2015-08-27 14:57:50 -04:00
Rene Moser 3db4039ad1 cloudstack: implement general api_region support, update docs 2015-08-25 13:54:21 +02:00
James Cammarata c7dde72aa0 Default listify to converting bare variables again
Since we explicitly set convert_bare=False in the template lookup
code, but still want individual looks that call listify directly to
convert bare variables if needed.
2015-08-12 10:49:46 -04:00
Brian Coca 6e825e8c22 fixed listify for lookups, made sure convert_bare is only on with_ 2015-08-11 16:42:09 -04:00
Brian Coca 5f0359c119 keep banners at 79 2015-08-06 17:37:05 -04:00
Brian Coca 25e67bb716 text wrap now adapts to terminal 2015-08-06 17:37:05 -04:00
James Cammarata d44daf53cc Allow wrapped text in deprecated messages 2015-08-06 17:21:02 -04:00
James Cammarata 5266679964 Use templar all the way down
Fixes bugs related to creating Templar() objects on the fly, where
the shared loader objects (serialized to TaskExecutor) aren't used
so information loaded into plugin loaders after forking is lost.

Fixes #11815
2015-08-04 12:25:53 -04:00
James Cammarata 2673eb0afb Add option to fail on undefined variables to listify
And use it in the call to get the loop items for a task.
2015-08-03 12:04:31 -04:00
Brian Coca 164092a835 optimized module docs 2015-07-27 20:52:53 -04:00
Brian Coca 0b6fadaad7 started implementing diff
diff now works with template
also fixed check mode for template and copy
2015-07-26 12:22:22 -04:00
Brian Coca b19eb0f4dc minor improvements to display 2015-07-25 09:15:33 -04:00
Toshio Kuratomi 36382face9 Add a warning about mode being octal 2015-07-24 14:52:21 -07:00
Brian Coca cff77de917 added todo for future of feature 2015-07-24 12:00:38 -04:00
Brian Coca 0089eb8102 reimplemented logging based on log_path var 2015-07-24 12:00:38 -04:00
James Cammarata e526743b4f Allowing `args: "{{some_var}}"` for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase,
however it is a common-enough feature that we will simply mark it
as deprecated for now and remove it at some point in the future.

Fixes #11718
2015-07-24 10:33:12 -04:00
Brian Coca 88e1ef8c9b implemented --step in v2 2015-07-23 20:47:40 -04:00
Brian Coca 851ed45bbf adding display to plugins and start moving debug to display 2015-07-23 10:26:12 -04:00
Jeff Widman 52716c4dc7 Remove mention of 'apache example'
Removed explicit mention of 'apache'
2015-07-21 18:03:55 -07:00
James Cammarata b8b206005c Generalize extra variable parsing and loading
Fixes #11352
2015-07-21 00:18:35 -04:00
Brian Coca 5a5b7ff561 fixed first_available_found for template, refactored into common function
added deprecation warning
fixed display.deprecated to make version optional (code already assumed this)
turned warning + 'deprecated' in plugin loader into actual call to deprecated()
2015-07-15 19:47:59 -04:00
Brian Coca 42e355f9a3 fragments can now be a list 2015-07-14 10:07:59 -04:00
Brian Coca ea159ef9de fixed backup and validate fragments 2015-07-14 10:07:59 -04:00
Brian Coca fe91f7b506 moved read_vault_file to CLI from utils and renamed to clearer read_vault_password_file 2015-07-11 14:24:45 -04:00
Toshio Kuratomi 49a148056c Ensure that we're dealing with byte str when we print or log messages 2015-07-07 12:05:59 -07:00
Marc Abramowitz 314bae2a9e Don't wrap text for AnsibleParserError
This allows not messing up the wonderful error reporting that is
carefully created. Instead of:

    $ ansible-playbook foo.yml
     [ERROR]: ERROR! 'foo' is not a valid attribute for a Task  The error appears
    to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7,
    but may be elsewhere in the file depending on the exact syntax problem.  The
    offending line appears to be:    tasks:     - name: do something       ^ here

we get:

    $ ansible-playbook foo.yml
    ERROR! 'foo' is not a valid attribute for a Task

    The error appears to have been in '/Users/marca/dev/git-repos/ansible/foo.yml': line 4, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: do something
          ^ here

which is much nicer.
2015-07-07 09:31:00 -07:00
Brian Coca 552715f072 added validate and backup doc fragments 2015-07-04 17:58:23 -04:00
Brian Coca dcb06ac7a8 Merge pull request #11445 from emonty/devel
Fix a tiny typo
2015-07-01 09:34:32 -04:00
Toshio Kuratomi 54e7c8a3f7 Add python requirement to the documentation for openstack modules requiring shade 2015-06-30 12:51:20 -07:00
Monty Taylor e89f1186e7 Fix a tiny typo 2015-06-30 14:46:43 -04:00
Brian Coca f576d29b6b allow for any non string iterable in listify 2015-06-15 11:02:51 -04:00
Brian Coca aed429554d better checks to ensure listify emits a non string iterable 2015-06-11 10:03:44 -04:00
Brian Coca 7291f9e965 removed cruft
made sure it does not fail on undefined
2015-06-11 00:13:40 -04:00
Brian Coca 7306a5397e simplified function, always attempt to template, always check if string before return, should avoid most cases of strings being passed to lookups 2015-06-10 22:55:50 -04:00
Brian Coca 5aec5e5eb0 fixed ansible pull, reorged validate function for cli to be function specific like parser
added missing cmd_functions with run_cmd, mostly for ansible pull
2015-06-09 17:24:43 -04:00
Brian Coca 9856a8f674 added missing imports to doc module 2015-06-03 15:00:41 -04:00
Brian Coca a87687dccb Merge pull request #11147 from sivel/module-docs-import-mutablemapping
Import missing MutableMapping class for module_docs
2015-06-03 14:50:17 -04:00
Matt Martz 89dceb503a Import missing MutableMapping class 2015-06-03 10:02:27 -05:00
Brian Coca 65b82f69e4 avoid failing when mode is none 2015-06-02 23:39:57 -04:00
Brian Coca ba02e5e3bf minor adjustments as per code review 2015-06-02 13:01:59 -04:00
Brian Coca 2590df6df1 created makedirs_safe function for use in cases of multiprocess
should fix #11126 and most race conditions
2015-06-02 11:41:30 -04:00
Rene Moser fc807e29c8 cloudstack: add api_timeout to doc fragments 2015-06-02 14:51:25 +02:00
Rene Moser 7bb9cd3766 cloudstack: minor cleanup in doc fragments 2015-06-02 14:51:25 +02:00
James Cammarata fe41f109a9 Merge branch 'v2_final' into devel_switch_v2 2015-06-01 16:42:59 -05:00
Monty Taylor 2046d76310 Add defaults and a link to os-client-config docs 2015-05-29 13:10:13 -07:00
Monty Taylor b659621575 Remove unneeded required_one_of for openstack
We're being too strict - there is a third possibility, which is that a
user will have defined the OS_* environment variables and expect them to
pass through.
2015-05-29 13:09:45 -07:00
Brian Coca e7a096c4c5 cowsay is back! 2015-05-28 20:01:39 -04:00
James Cammarata 2bad888f28 Merge branch 'v2_final' into devel_switch_v2
Conflicts:
	lib/ansible/inventory/__init__.py
	lib/ansible/modules/core
	lib/ansible/utils/__init__.py
	lib/ansible/utils/module_docs.py
2015-05-28 15:26:03 -05:00
Serge van Ginderachter b6ea8de399 limit extensions for files in group/host_vars dir
inventory vars: make loading from a directory obey the same rules as
when checking the base paths, looking at the file name extensions
as defined in CONSTANTS.YAML_FILENAME_EXTENSIONS

Fixes Github issue #11017
2015-05-23 20:34:08 +02:00
Brian Coca 9a88e0fc8e removed empty choices from files 2015-05-19 10:46:44 -04:00
Brian Coca da6d15d1f9 removed empty choices from files 2015-05-19 10:46:20 -04:00
Brian Coca 8fdf9ae59b moved module_doc_fragments to v2 2015-05-12 12:18:55 -04:00
Toshio Kuratomi 490cde3cbd Add python2.6+ as a documented requirement for rackspace modules 2015-05-11 12:25:03 -07:00
Toshio Kuratomi c80c5c980d Add python2.6 dep to aws and cloudstack doc fragments 2015-05-11 10:10:58 -07:00
Toshio Kuratomi 4839243366 Documentation fixes 2015-05-05 13:51:22 -07:00
Brian Coca 17e65b45d0 Merge pull request #10913 from bcoca/sudosu_ask_fix
now properly inherit data from ansible.cfg for sudo/su ask pass
2015-05-04 16:51:19 -04:00
Brian Coca b23a879273 now properly inherit data from ansible.cfg for sudo/su ask pass
fixes #10891
2015-05-04 16:42:25 -04:00
Toshio Kuratomi cbde1c5ec0 Fix extending non-dict types from doc fragments 2015-05-04 13:39:07 -07:00
Toshio Kuratomi b19d426f0b Normalize the way requirements is specified 2015-05-04 13:39:07 -07:00
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00
Carlos E. Garcia cfbfd38723 just a few spelling error changes 2015-04-28 09:36:42 -04:00
Brian Coca d5a7cd0efc bad hack to maybe fix some corner cases with pbrun custom prompts 2015-04-14 12:44:28 -04:00
Feanil Patel 0abcebf1e4 Don't convert numbers and booleans to strings.
Before this change if a variable was of type int or bool and the variable was referenced
by another variable, the type would change to string.

eg. defaults/main.yml
```
PORT: 4567
OTHER_CONFIG:
  secret1: "so_secret"
  secret2: "even_more_secret"

CONFIG:
  hostname: "some_hostname"
  port: "{{ PORT }}"
  secrets: "{{ OTHER_CONFIG }}"
```

If you output `CONFIG` to json or yaml, the port would get represented in the output as a
string instead of as a number, but secrets would get represented as a dictionary.  This is
a mis-match in behaviour where some "types" are retained and others are not.  This change
should fix the issue.

Update template test to also test var retainment.

Make the template changes in v2.
Update to only short-circuit for booleans and numbers.

Added an entry to the changelog.
2015-04-11 12:03:42 -04:00
Brian Coca 92e400eb6d fixed minor issues with openstack docs not being valid yaml 2015-04-02 21:08:17 -04:00
Brian Coca 42b7321d4b Merge pull request #10587 from bcoca/fix_unrelated_lookup_fail
dont break everything when one of the vars in inject does not template
2015-04-02 15:49:18 -04:00
Brian Coca 4dd233b0dd Merge pull request #10237 from emonty/remove-auth-token
Remove auth token and port openstack module_utils changes to v2 tree
2015-04-01 12:20:59 -04:00
Monty Taylor 87c99b4675 Align verify parameter with validate_certs
The rest of ansible uses validate_certs, so make that the main
documented parameter. However, leave verify as an alias since that's the
passthrough value to the underlying libraries.
2015-04-01 07:54:02 -04:00
Brian Coca 0d1e2e74a1 converted error on play var initialization into warning with more information 2015-03-31 23:07:03 -04:00
Brian Coca 17e086fe8c dont break everything when one of the vars in inject does not template correctly, wait till its used 2015-03-31 21:36:18 -04:00
Monty Taylor 90ca386555 Add api timeout now that shade spports it everywhere 2015-03-31 20:29:06 -04:00
Brian Coca 299314c6b6 Merge pull request #10545 from resmo/feature/cloudstack-utils
cloudstack: common code used in cloudstack modules
2015-03-30 22:03:45 -04:00
Brian Coca 76e3a9c93a Merge pull request #9894 from 47lining/cloud_modules_sts_support_redux_ansible
Cloud Modules STS Support Redux
2015-03-27 08:20:43 -04:00
Rene Moser 1ba05dd3a2 cloudstack: add doc fragment 2015-03-26 14:18:23 +01:00
Toshio Kuratomi c024057e97 Fix assert to work with unicode values 2015-03-25 12:24:49 -07:00
Brian Coca a47c132695 slight changes to allow for checksum and other commands to work correctly with quoting 2015-03-16 19:09:03 -04:00
Shirou WAKAYAMA d92e8edf6e set 'nonstring' arg to passthru. 2015-03-12 12:36:50 +09:00
Shirou WAKAYAMA 2d73892acf use to_unicode() in _jinja2_vars if type is str. 2015-03-11 14:50:27 +09:00
Brian Coca 5f6db0e164 preliminary privlege escalation unification + pbrun
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe

- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
2015-03-10 18:42:36 -04:00
Monty Taylor 8758ba08bd Update common OpenStack requests-related parameters
Also, update docs related to earlier changes in this stack.
2015-03-06 18:20:45 -05:00
Brian Coca 346689f9f2 Merge pull request #9293 from cchurch/module_suffixes
Simpler fix for module suffixes than c02e8d8c8.
2015-02-26 23:33:51 -05:00
Toshio Kuratomi 0f4b72cdfa Refactor loop to only calculate the full_path once 2015-02-26 16:01:42 -08:00
Toshio Kuratomi 68c99a12b3 Merge pull request #10346 from lekum/find_plugin_bugfix
Bug fix: Search only for files as candidates
2015-02-26 15:38:45 -08:00
Toshio Kuratomi 8a5067d628 Adapt sanitize_output to log messages instead of assuming properly formatted key-value pairs
Fixes #10332
2015-02-26 12:31:11 -08:00
Alejandro Guirao b8cf131375 Bug fix: Search only for files as candidates 2015-02-26 19:13:07 +01:00
Monty Taylor 0b8773fc99 Remove state from central argument list
There is an old PR that shows a great use case for having a different
set of states for the server module. Before the other modules start
being in real use, pull this out so that we don't get ourselves into a
pickle.
2015-02-26 11:35:29 -05:00
Brian Coca 57674fa047 Allow requesting a list to lookup plugins instead of , delimited string 2015-02-19 18:29:29 -05:00
Brian Coca 1e818f9c50 ansible-doc now shows return value docs 2015-02-19 13:18:05 -05:00
jensdepuydt 730c2ba403 minor change to not search in non-existing paths 2015-02-18 12:07:35 +01:00
Toshio Kuratomi 68e86de26f Optimize the plugin loader.
We have been caching the paths to the plugins but before we would only
cache the specific plugin that we were looking for.  This meant that we
might search through all of the plugin directories before finding the
specific module we were interested in.  The next plugin we needed we
might again search through all the plugin directories before finding the
plugin we wanted.

This new code will cache all the potential plugins in each directory
searched.  For a play that only uses one plugin we'll only search
through directories until we encounter the directory that has the proper
plugin.  For a large playbook with many plugins used we'll search
through each directory at most once each.

This should alleviate #10165
2015-02-17 13:24:46 -08:00
Brian Coca e41d48104f valutpass fix in password reorog 2015-02-16 12:24:43 -05:00
Cove Schneider 825654a2fa parse yaml using cparser if present 2015-02-16 00:26:35 -08:00
Brian Coca 932fd2eda2 fixed vault pass also 2015-02-12 19:03:50 -05:00
Brian Coca 0087816b13 fixed varname su_pass 2015-02-12 19:03:04 -05:00
Brian Coca 5f2d5abeea ensure proper strings/unicodestrings for passwords
updated to correct to_bytes function
removed old to_bytes/to_unicode and repointed clients to new location
fixed unicode test
2015-02-12 17:44:08 -05:00
Toshio Kuratomi 9d605171a7 Didn't port isbasestring/isunicodestring from kitchen so switch to isinstance 2015-02-12 13:55:27 -08:00
Brian Coca 0912781357 Merge pull request #9421 from emonty/features/new-openstack
Add support for new OpenStack modules
2015-02-12 10:26:12 -05:00
Matt Martz 68358e31fb Allow ansible (ad-hoc) to support --extra-vars also 2015-02-11 19:34:01 -06:00
Monty Taylor 9b17918bc9 Add doc fragment for new OpenStack modules 2015-02-11 14:04:59 -05:00
Brian Coca c966eb5d80 Merge pull request #10015 from bcoca/nicer_json_errors
handle json load errors as ansible error instead of ugly stacktrace
2015-02-11 13:31:25 -05:00
Nicolas Le Manchet faa2449f55 Set proper permissions for ansible-vault view 2015-02-11 14:15:38 +01:00
Henk Wiedig 0a902a5afd make su promt AIX compatible
$ su suuser date
suusers's Password:
2015-02-10 05:18:37 -05:00
Brian Coca 75d3c6b104 Merge pull request #10185 from bcoca/valut_editor_missing_err
better missing editor message
2015-02-09 18:16:57 -05:00
Toshio Kuratomi 4902c06304 Obfuscate passwords in more places where it is displayed 2015-02-09 10:13:13 -08:00
Brian Coca 8b7dc6bbfb better missing editor message
fixes #10182
2015-02-08 23:26:56 -05:00
Toshio Kuratomi a04138a887 Add v2's unicode.py to utils so we can use unicode_wrap in the filter_plugins 2015-02-02 19:09:08 -08:00
Toshio Kuratomi 1011959d88 Move the hashing util functions to their own file to mirror v2 2015-02-02 10:25:09 -08:00
Toshio Kuratomi 3d5523fbb7 Fix for unicode filenames for template module
Fixes #10110
2015-01-28 14:24:57 -08:00
Brian Coca 9d190c8d8d Revert "Support variable values with dashes" 2015-01-26 12:54:50 -05:00
Brian Coca 13bbf9bfbb Merge pull request #9834 from nathancahill/fix-variables-with-dashes
Support variable values with dashes
2015-01-26 12:51:56 -05:00
Brian Coca c09d27bca1 handle json load errors as ansible error instead of ugly stacktrace 2015-01-15 12:03:13 -05:00
Mick Bass 17498b58bb Add support for AWS Security Token Service (temporary credentials) to all AWS cloud modules. 2014-12-25 13:31:34 -07:00
Toshio Kuratomi 5ed7a55990 Restore json import for redis as well. Switch preference to simplejson for speed 2014-12-23 13:14:14 -08:00
Nathan Cahill 6d785ca081 support variables with dashes - fixes #9786 2014-12-16 20:58:38 -07:00
Nicolas Rémond 3cf0c09ce9 Variables lookup in a template should handle properly the undefined case 2014-12-12 12:11:17 +01:00
Brian Coca 97408fe5b2 Revert "Make listify respect the global setting for undefined variables."
This 'mostly' reverts commit 2769098fe7.

Conflicts:
	lib/ansible/utils/__init__.py
	test/units/TestUtils.py
2014-12-04 09:14:53 -05:00
Brian Coca e938f554b7 better exception handling for unexpected exceptions 2014-12-04 08:01:38 -05:00
Brian Coca f2b853f7a0 changed plugin load priority to be path based, not suffix based. 2014-12-01 17:36:57 -05:00
Brian Coca 9a5cbf747a fine tuned lookup/templating errors 2014-11-26 22:06:37 -05:00
Brian Coca db145a368d now only flattened ignores failonundefined cause of it's special need 2014-11-25 16:12:15 -05:00
Brian Coca e3feb104c3 fixes issues with listyfing failing too often 2014-11-25 15:55:53 -05:00
Brian Coca 7d2937b1cc minor fixes to template function
- make sure it calls itself correctly, now passes same params as it recieves
- vars is reserved, changed for templatevars to avoid confustion
- forcing mustaches again since the removal broke 'listification' as per #9622
- fixes incorrectly successful tests using undefined var, now it is defined
- now returns empty list if items is None to avoid errors
2014-11-25 12:59:13 -05:00
Toshio Kuratomi c4c3cc315d Transform both values of a task name into a byte str prior to comparing
Fixes #9571
2014-11-19 11:50:02 -08:00
Toshio Kuratomi 25607e5cf4 When run in FIPS mode, allow vault to fail only when using legacy format 2014-11-17 16:38:56 -08:00
Brian Coca 395952329a Merge pull request #9529 from sivel/env-nested-modules
Support nested modules with ANSIBLE_LIBRARY env var
2014-11-12 10:59:18 -05:00
Toshio Kuratomi 9a7eb57718 Some changes to FIPS compat since SLES implements it differently 2014-11-11 20:23:03 -08:00
Toshio Kuratomi 6a85f3ebc7 Add comments/docstrings not to use md5 unless forced to by forces outside our control. 2014-11-10 12:01:44 -08:00
Matt Martz 4c2d06d2fe Support nested modules with ANSIBLE_LIBRARY env var 2014-11-10 10:52:23 -06:00
Toshio Kuratomi f1267c0b05 Move from md5 to sha1 to work on fips-140 enabled systems 2014-11-06 21:28:04 -08:00
Brian Coca b3b356480d added the ability to keep aliased and deprecated modules prefixed with
'_', they will be loaded after non prefixed modules are checked they can
be full modules or symlinks to existing ones (alias)

also updated ansible doc to ignore these, will eventually add selective
display
2014-10-27 15:54:41 -07:00
James Cammarata 9ee3cd14ee Fix typo in vault edit helper code
Fixes #9399
2014-10-22 11:08:01 -05:00
Toshio Kuratomi 3d135f98d1 Small python3 compat in vault to keep code in sync with v2 2014-10-21 10:32:25 -04:00
Toshio Kuratomi da9d87b1d4 Make vault file creation use a tempfile 2014-10-21 00:32:08 -04:00
James Cammarata b61a78532c Catch template syntax errors specifically when templating strings
Fixes #9333
2014-10-20 13:11:20 -05:00
Toshio Kuratomi 48a308a87c Allow both old-style and new-style role dependencies to be valid.
Fixes #9173
2014-10-09 02:48:47 -04:00
Toshio Kuratomi c75aeca435 Merge removal of complex_args_hack 2014-10-08 15:03:43 -04:00
Toshio Kuratomi a10d10f647 Workaround more python-2.6 shlex not being able to handle unicode strings 2014-10-08 14:30:36 -04:00
Chris Church 8fb88be41b Simpler fix for module suffixes than c02e8d8c8. 2014-10-08 11:53:06 -04:00
Rob Howard 2769098fe7 Make listify respect the global setting for undefined variables.
(Fixes #9008.)

With credit to jimi-c for the initial pass in this commit:
b18bd6b98e
2014-10-08 13:47:11 +11:00
James Cammarata 05644686de Fix bug in plugin path caching
Fixes #9263
2014-10-04 21:47:38 -05:00
Toshio Kuratomi cef2a8795f Make dynamic inventory return byte str, not unicode 2014-10-02 20:27:06 -04:00
James Cammarata d99e4f15c8 Merge pull request #9220 from jlaska/devel
Resolve issue where repo_path contains multiple '.git' strings
2014-10-01 14:23:23 -05:00
Toshio Kuratomi 0af750e3e5 Merge pull request #9182 from bbasleeper/feature_sudo_exe_from_inventory
Add a new inventory parameter (ansible_sudo_exe) to specify sudo command...
2014-09-30 14:55:46 -04:00
James Cammarata 05994cd900 Don't clear paths when adding a new directory path in PluginLoader 2014-09-30 09:43:40 -05:00
James Laska 684352926b Resolve issue where repo_path contains multiple '.git' strings
If the repo_path contained multiple '.git' strings, the _git_repo_info()
call resulted in a traceback.  This change removes the trailing '.git'
and resolves the traceback.
2014-09-30 10:33:42 -04:00
Michael DeHaan c02e8d8c80 Don't search powershell modules unless using the winrm connection. 2014-09-28 12:17:03 -04:00
Michael DeHaan 3908d50b03 Tolerate no module search path. 2014-09-28 12:10:36 -04:00
Michael DeHaan 1d17881960 Add module search path to --version output. 2014-09-28 11:39:04 -04:00
Michael DeHaan 21c3784a43 If submodules are not found, don't error out. 2014-09-28 11:25:04 -04:00
Will Thames 952a36920c Cater for uninitialized submodules
Output a useful message if `git submodule update --init --recursive` not
yet performed

```
$ ansible --version
ansible 1.8 (submodule_ansible_version 59ae596484) last updated 2014/09/28 13:20:51 (GMT +1000)
  lib/ansible/modules/core: (detached HEAD 617a52b20d) last updated 2014/09/28 13:15:25 (GMT +1000)
  lib/ansible/modules/extras:  not found - use git submodule update --init lib/ansible/modules/extras
```
2014-09-28 11:25:04 -04:00
Will Thames d1476aeb01 Updated version info to include submodule information
`ansible --version` etc. now include information about submodules

```
ansible 1.8 (submodule_ansible_version ffee9a8fe0) last updated 2014/09/28 11:03:14 (GMT +1000)
  lib/ansible/modules/core: (ec2_snapshot_remove 3a77c31ecb) last updated 2014/09/27 18:23:31 (GMT +1000)
  lib/ansible/modules/extras: (detached HEAD 110250d344) last updated 2014/09/27 14:33:42 (GMT +1000)
```

Also improved handling of detached HEAD when printing out version
information.
2014-09-28 11:25:04 -04:00
Bruno BAILLUET a25da4af05 Add a new inventory parameter (ansible_sudo_exe) to specify sudo command path. 2014-09-27 17:39:49 +02:00
Michael DeHaan e5116d2f9b changes for package loading of modules 2014-09-26 11:25:56 -04:00
Michael DeHaan 25cc79e2db Modules is a package. 2014-09-26 10:55:00 -04:00
James Cammarata 128c10b311 Don't template 'vars' dictionary during templating
Fixes #9132
2014-09-25 14:46:16 -05:00
James Cammarata 889dfc4374 Merge pull request #8959 from willthames/galaxy_ssh_clone
Allow fairly common ssh repo clone path to work
2014-09-23 14:58:29 -05:00
James Cammarata 9d45f3a65e Before decrypting check if vault password is set or error early
Fixes #8926
2014-09-19 15:10:30 -05:00
James Cammarata b376e208c7 Adding "follow" param for file/copy options
Also modifies the template action plugin to use this new param
when executing the file/copy modules for templating so that links
are preserved correctly.

Fixes #8998
2014-09-16 12:05:55 -05:00
Michael DeHaan d6e6d2a6ca Remove regex related to baby-JSON parsing only. 2014-09-11 13:30:10 -04:00
Michael DeHaan 26cdddaebf Tracebacks are now catchable with ignore_errors and have streamlined output. Also removes 'baby-JSON' for bash modules. 2014-09-11 12:27:21 -04:00
Will Thames d6a725659e Allow github style ssh repo names 2014-09-10 21:55:27 +10:00
Will Thames 537472f42c Make ansible-galaxy work as expected
This change fixes hg galaxy roles
Roles also get installed if roles path is missing, which
the tests currently require (fixes #8950)
2014-09-10 09:16:30 +10:00
Niko Felger fa74a5c806 Fixing issue with symlinked vaults 2014-09-08 16:10:18 +02:00
James Cammarata 8cc3543918 Re-allow templating of complex_args, but count params to prevent injection
Fixes #8810
2014-09-05 14:24:05 -05:00
James Cammarata 04da466c7b Fixing up serialize_args utility function 2014-08-27 10:20:07 -05:00
James Cammarata e99db078b4 Additional fixes for the new omit parameter variable 2014-08-27 10:06:55 -05:00
Victor Lin 559c04f324 Implement omit for module args, also add tests for it 2014-08-27 10:04:47 -05:00
Victor Lin 0b4d7f1574 Implement default omit filter 2014-08-27 10:03:07 -05:00
James Cammarata 811ff49f78 Updating CHANGELOG for new symbolic mode feature and updating file docs 2014-08-25 23:47:41 -05:00
y_nk affdadda25 handling case of space in path (given would start with single quote) 2014-08-25 21:26:47 +05:30
Michael DeHaan 8a0045baad Update tests for ansible-galaxy CLI additions. 2014-08-22 14:01:15 -04:00
Michael DeHaan d87830e1cc Merge branch 'galaxy_github_archive' of git://github.com/willthames/ansible into devel
Conflicts:
	lib/ansible/utils/__init__.py
2014-08-22 13:58:50 -04:00
James Cammarata d01188033f Checking for localized versions of the su password prompt
Fixes #8681
2014-08-22 09:59:40 -05:00
Michael DeHaan 0286c31e85 Assume master branch for downloads if not specified. 2014-08-22 10:01:13 -04:00
Michael DeHaan 0cd40fc372 Remove debug 2014-08-22 09:58:27 -04:00
Will Thames 850963790d Allow roles to be installed from archives on github
Ensure that the automated scm determination for github.com
repos still copes with .tar.gz archive files.

Handling .zip archives is left as an exercise for the interested reader
2014-08-22 10:06:21 +10:00
Michael DeHaan bcb44276fe Assume github.com URLs are git protocol if not specified. 2014-08-21 17:15:23 -04:00
Michael DeHaan 68e21aa4b0 Add comments about what these new functions do. 2014-08-21 17:15:23 -04:00
Will Thames 6e9abefc11 Corrected bug where role_path was wrong for roles in subdirectories
Fixed role name for
    - { role: 'lives/in/a/subdirectory' }
Should be 'lives/in/a/subdirectory', not just 'subdirectory'
2014-08-21 17:15:23 -04:00
Will Thames ada9074276 Allow installation of roles from yaml roles file
Added docs
Added more tests
Improved how roles are returned from the parsers
2014-08-21 17:15:23 -04:00
Will Thames 46b59b02ed Friendly Role Names and roles from URLs
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
2014-08-21 17:15:23 -04:00
Will Thames 4803e923ff Improved handling of role_version in repo_url_to_role_name 2014-08-21 17:15:23 -04:00
Will Thames c2fe33f9f4 Tidied up a little, added tests
Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
2014-08-21 17:15:23 -04:00
James Cammarata bae73e5793 Merge branch 'alozovskoy-alozovskoy-debug-ascii-patch' into devel 2014-08-21 15:57:43 -05:00
James Cammarata 4fafd3baa8 Add error checking around json.dumps when not forcing ascii mode 2014-08-21 15:52:36 -05:00
James Cammarata b81e77cfec Tweak error language in dict validation 2014-08-21 13:24:53 -05:00
Serge van Ginderachter b8d057296a variable merging: detect if both vars are really dicts when combining/merging dicts 2014-08-21 18:06:02 +02:00
James Cammarata 8a1fbed5d6 Correct variable blending from vars_files with hostvars in them
Fixes #8638
2014-08-20 15:49:01 -05:00
James Cammarata 379e31883c Fix check mode issues with copy module
Fixes #8639
2014-08-18 16:02:45 -05:00
Michael DeHaan 99c39b1ff3 By popular request, make the no_log attribute also censor tasks from callbacks. 2014-08-12 13:36:05 -04:00
Jakub Paweł Głazik 99a339fa7b Fix comments and error message 2014-08-11 16:02:10 -04:00
Jakub Paweł Głazik 58feee0f45 ansible-vault view - new command 2014-08-11 16:02:10 -04:00
Josh Drake aa419044c4 WIP on the re-implementation of fact caching and various backends. 2014-08-11 12:23:05 -04:00
Michael DeHaan fb5a1403dd Merge 2014-08-11 12:22:55 -04:00
James Cammarata 25e9d1197e Merge branch 'optimise_utils_clean_data' of https://github.com/leth/ansible into leth-optimise_utils_clean_data 2014-08-11 10:21:02 -05:00
Marcus Cobden c47d1f5265 Pre-load whole string and use seek to alter tags 2014-08-11 09:10:06 +01:00
Marcus Cobden c8bfd157f8 Switch cStringIO to StringIO for unicode support
The performance difference isn't too bad
2014-08-11 08:48:37 +01:00
Marcus Cobden 84114e5c0b Fix copy/paste error 2014-08-11 08:43:40 +01:00
Marcus Cobden ef65d3dbf6 Optimise string handling in ansible.utils._clean_data 2014-08-09 23:47:08 +01:00
James Cammarata 63bf2f6d9a Preserve all line breaks in literal blocks
Fixes #8512
2014-08-08 12:11:15 -05:00
Michael DeHaan 8c4161d4a1 Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	plugins/callbacks/mail.py
2014-08-08 12:17:37 -04:00
Michael DeHaan 48a0236ec6 Merge pull request #6619 from sergevanginderachter/ansible_version_var
Introduce an ansible_version dict as runner variable
2014-08-08 11:20:17 -04:00
James Cammarata a45c3b84f3 Avoid templating raw lookup strings 2014-08-06 13:25:14 -05:00
Alexander Lozovskoy 5165dfa2df Issue with printing unicode non-english characters #8425 patch 2014-08-06 12:38:14 +04:00
Michael DeHaan 1c6398dd3b Resolve option conflict differently. 2014-08-05 20:45:16 -04:00
Michael DeHaan b4b115cd13 File common arguments should not be used in all docs pages. 2014-08-05 20:45:16 -04:00
Michael DeHaan 4312391e0a (A) Fix a bug in the doc generator that was clobbering the force parameter for the copy module.
(B) This is a work in progress but the idea is to have text snippets where we can respond to tickets with a bit more helpful info.
Not active just yet.
2014-08-05 20:10:15 -04:00
James Cammarata 6d94ae64ec Remove unnecessary unicode conversions from parse_kv
Fixes #8425
2014-08-04 09:59:08 -05:00
Grzegorz Nosek 7f33580eba Fix exponential regex performance issue
filter_leading_non_json_lines effectively does

re.match(".*\w+=\w+.*", line)

for every line of output. This has abysmal performance in case of large
Base64-encoded data (which ultimately does not match the regex but does
match the .*\w+= part) as returned e.g. by the template module (diffs).

Replacing the match with

re.search("\w=\w", line)

drops the complexity back to linear, and actually usable with large
diffs from the template module (a 150 KB Base64 diff kept Ansible
spinning at 100% cpu for minutes).

Also, check the easy cases (line.startswith) first while we're here.

Closes: #8932
2014-08-01 14:46:00 +02:00
James Cammarata 189824dd76 Remove whitespace around args
Fixes #8343
2014-07-30 08:51:27 -05:00
James Cammarata e6fa50a306 Move splitter to module_utils so modules can use it and fix command arg splitting
Fixes #8338
2014-07-29 14:55:16 -05:00
James Cammarata a9f0f8e975 Revert "template.py: Handle purposely raised exceptions in lookup()"
This reverts commit 2fda9bc743.
2014-07-28 23:25:37 -05:00
James Cammarata aee940aaca Reworking _clean_data() to be smarter about replaces
Fixes #8228
2014-07-28 16:50:18 -05:00
James Cammarata 7344baeffa Make sure empty non-quoted tokens are not added to the arg params list 2014-07-25 15:23:10 -05:00
James Cammarata 3714c0742f Split args on single spaces only 2014-07-25 13:13:15 -05:00
James Cammarata 63bcbd0af2 Fix for unicode decoding error in new splitting code
Also adds a new unicode integration test
2014-07-25 09:10:50 -05:00
Michael DeHaan 8d42f5cbfa Smush ds removal 2014-07-24 20:38:02 -05:00
James Cammarata b8a4ba26f0 Refactoring split_args into sub-functions 2014-07-24 20:00:57 -05:00
Michael DeHaan 630f080cf0 Start of unit tests for split_args function, moved split_args to utils since not needed by modules (so far). 2014-07-24 20:15:04 -04:00
James Cammarata 43154e5101 Using custom splitting function for module param counting 2014-07-24 14:42:35 -05:00
James Cammarata 84759faa09 Security fixes:
* Strip lookup calls out of inventory variables and clean unsafe data
  returned from lookup plugins (CVE-2014-4966)
* Make sure vars don't insert extra parameters into module args and prevent
  duplicate params from superseding previous params (CVE-2014-4967)
2014-07-21 11:20:49 -05:00
James Cammarata 0e5b0a2e97 Revert "Set Jinja2's keep_trailing_newline=True in template_from_string."
This reverts commit 7a8eb0b670.
2014-07-17 09:07:04 -05:00
Jacob Leverich 7a8eb0b670 Set Jinja2's keep_trailing_newline=True in template_from_string.
Without this setting, the newline idempotence of scalar strings changes depending on whether
or not they contain any Jinja2 template blocks.
2014-07-14 13:36:17 -07:00
James Cammarata 4fc8d4b6fe Merge pull request #7649 from sivel/vault-password-script
Allow --vault-password-file to work with a script as well as a flat file
2014-07-14 10:57:16 -05:00
James Cammarata db96344966 Re-fixing ability to have empty json files after inventory refactoring 2014-07-11 13:20:00 -05:00
James Cammarata fe892fccb1 Merge remote-tracking branch 'svg/varsplugins_refactor' into svg_and_inventory_refactor 2014-07-07 14:16:37 -05:00
Henry Finucane de64bbdc5f Support a whitelisted subset of jinja2 template options 2014-07-02 21:14:26 -07:00
James Cammarata 8ed6350e65 When parsing json from untrusted sources, remove templating tags 2014-07-01 14:14:14 -05:00
James Cammarata eeb597360e Further safe_eval fixes 2014-07-01 14:14:14 -05:00
James Cammarata 35368e531b Additional fixes for safe_eval 2014-06-25 21:26:32 -05:00
James Cammarata 5429b85b9f Change safe_eval to a strict white list 2014-06-25 14:00:21 -05:00
Matt Martz 19f5ce2c9c Allow --vault-password-file to work with a script as well as a flat file 2014-06-24 15:02:24 -05:00
Paul Sokolovsky f8bf9cdeec Handle TemplateNotFound to render more helpful error message.
At the point the exception is handled, it is likely due to error loading
a sub-template included from main template. Besides file not found, it
can be caused also by include path failing Jinja2 checks. Now, when
rendering the exception from Jinja, it will include exception name. This
will give basic context or *what* the error is.

Fixes #7103
Fixes #7105
2014-06-23 15:02:58 -05:00
Chris Church 243cd877ae Add integration tests for fetch/slurp, make powershell fetch/slurp work as close as possible to existing fetch/slurp modules. 2014-06-19 14:25:28 -05:00
Matt Martz e7e95721b9 powershell modules will have a .ps1 extension 2014-06-19 14:24:13 -05:00
Chris Church 5dcaa30476 Add shell_plugins to abstract shell-specific functions out of runner, add winrm connection plugin, add initial Windows modules. 2014-06-19 14:24:12 -05:00
James Cammarata cb13b30362 Use file documentation fragement for the copy module 2014-06-16 15:36:15 -05:00
James Cammarata 0fa5100a2c Merge branch 'fix-7596' of https://github.com/kilburn/ansible into kilburn-fix-7596 2014-06-03 10:26:25 -05:00
Jack Neely 2fda9bc743 template.py: Handle purposely raised exceptions in lookup()
If a lookup plugin is run by the lookup() template method it should pass
along any AnsibleError (or child exception classes) rather than just eat
them.  These exceptions are purposely raised by the plugin.
2014-05-30 16:41:20 -04:00
Marc Pujol d0f82e94e8 Ensure there are no duplicates in the merged/intersected lists 2014-05-30 15:47:18 +02:00
Marc Pujol f892cc798c Merge and intersect lists without using sets.
Using sets for these operations is dangerous because sets cannot contain
certain object types (such as lists) and their iteration order is
undefined.

Fixes #7596
2014-05-30 09:07:57 +02:00
James Cammarata 92f16b3d6f Merge pull request #7539 from jimi-c/issue_7503_freebsd_su_fixes
Fixes for su on freebsd
2014-05-25 15:09:58 -05:00
Abhijit Menon-Sen f6792b724a Don't double (or triple) up common error messages
process_common_errors() was called thrice, each time appending to the
existing error message, and leading to confusing repetition in the
message that was finally displayed.

Fixes #7498
2014-05-23 21:05:42 +05:30
James Cammarata 1e672a0fec Fixes for su on freebsd
Addresses multiple issues when using su on freebsd including
* su prompt differs between platforms, so turned that check into a
  regex comparison instead of a simple string comparison
* not using '-c' after su causes problems, so added that for all
  platforms
* fixed quoting issues due to multiple uses of '-c' introduced by
  the above fix

Fixes #7503
Fixes #7507
2014-05-23 10:06:09 -05:00
James Cammarata 7faecd54b0 Merge pull request #7388 from jimi-c/issue_7384_vars_files_include
Pass vars_files on to included playbooks too
2014-05-14 14:52:33 -05:00
James Cammarata a9311a5dcb Merge branch 'file_new_dirs_perms' of https://github.com/bcoca/ansible into bcoca-file_new_dirs_perms 2014-05-14 13:53:08 -05:00
James Cammarata 85bd6810bb Pass vars_files on to included playbooks too
Fixes #7384
2014-05-14 08:37:47 -05:00
Brian Coca 8a84b22d76 bumped to 1.7 2014-05-06 23:43:07 -04:00
Christian Berendt 6676720ce5 fixed typos found by RETF rules in PY files
rules are avaialble at https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos
2014-05-03 18:40:05 +02:00
James Cammarata 8e45fa9b63 Moving display-related functions to new module in utils 2014-04-30 15:33:46 -05:00
James Cammarata 6069ff6e9e Adding a new system_warnings config option to supress warnings 2014-04-30 14:44:10 -05:00
James Cammarata 4cadcccc48 Catch pycrypto warning about gmp and show a nice warning on stderr 2014-04-29 14:28:14 -05:00
James Cammarata 1576e8d611 Adding missing options to the file documentation fragment 2014-04-28 15:31:24 -05:00
Brian Coca c5d5481ebb added doc noting the change in behaviour 2014-04-27 09:37:44 -04:00
James Cammarata b9d8b3b911 Merge pull request #7132 from jimi-c/issue_6601_hide_vault_yaml
Hide YAML content on syntax errors when a vault password is specified
2014-04-24 00:28:12 -05:00
James Cammarata 460794d697 Merge pull request #7140 from jimi-c/issue_6962_traceback_callbacks_unicode
Fix handling of non-JSON lines in responses
2014-04-23 19:53:42 -05:00
James Cammarata 5e598c5337 Fix handling of non-JSON lines in responses
Garbage lines with ' = ' in them were causing parsing errors,
where key=val lines should not have spaces around the equals.

Fixes #6962
2014-04-23 15:17:31 -05:00
James Cammarata 93b5769d94 Hide YAML content on syntax errors when a vault password is specified
Fixes #6601
2014-04-23 09:23:07 -05:00
James Cammarata 75e0b7a5cf Make sure umask is set restrictively before creating any vault files 2014-04-18 13:38:59 -05:00
James Cammarata 2cc4ac2e75 Catch traceback caused by permissions errors during a local md5 sum
Fixes #6948
2014-04-14 12:41:21 -05:00
willthames 509561f658 Moved AWS modules over to common module fragments
Created common module doc fragment, and applied to all
modules that use ec2_connect or connect_to_aws as
they definitely share the common doc fragments
2014-04-09 21:19:12 +10:00
James Tanner 2d33cd1b5d Fixes #6894 add missing file and remove debug line 2014-04-08 13:22:23 -04:00
James Tanner 68cd7258b6 Fixes #6894 create docs fragment for files 2014-04-08 13:20:15 -04:00
Serge van Ginderachter d240e2b9fb Introduce an ansible_version dict as runner variable
Given the version:
    "1.6 (ansible_version_var 14499e8bf3) last updated 2014/03/21 17:07:50 (GMT +200)"

  We get the special variable:
    "ansible_version": {
        "full": "1.6",
        "major": 1,
        "minor": 6,
        "revision": 0,
        "string": "1.6 (ansible_version_var 14499e8bf3) last updated 2014/03/21 17:07:50 (GMT +200)"
       }

	modified:   lib/ansible/playbook/__init__.py
	modified:   lib/ansible/runner/__init__.py
	modified:   lib/ansible/utils/__init__.py
2014-04-08 17:14:42 +02:00
James Tanner 5a65dc3b6a Fixes #6820 fix erroneous missing vault password error when using the template module 2014-04-04 13:06:35 -04:00
Michael DeHaan 1fa19e29e8 Use common file argument system previously implemented by @sivel for rax modules on the file modules as well (copy/file/template).
Application to other cloud providers would make very good sense.
2014-04-03 16:52:39 -04:00
Matt Martz 7b5f89ec7c Use PluginLoader for module docs fragments 2014-04-03 16:52:39 -04:00
Matt Martz bb6f7a267a Add support for shared module documentation fragments 2014-04-03 16:52:39 -04:00
James Cammarata ee0a0b492b Allow isprintable() util function to work with unicode
Fixes #6842
2014-04-03 15:29:51 -05:00
James Cammarata 6f34a6336f Differentiate decryption failures from empty data files in ansible-vault
Fixes #6822
2014-04-02 15:52:08 -05:00
James Cammarata a4df906fc9 Fixes to safe_eval 2014-04-01 16:23:22 -05:00
Cristian Ciupitu 1eaf85b89f Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-27 20:35:20 +02:00