Commit graph

333 commits

Author SHA1 Message Date
ian
6747f82547 Change exceptions to python3 syntax. 2015-04-13 12:35:20 -04:00
Dorian Pula
b193d327b6 Fix re import failure in templates module when running unit tests. 2015-04-13 12:17:07 -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
Toshio Kuratomi
2af6314f57 Comment to clarify why we add one to the line and column recording 2015-04-10 04:09:50 -07:00
Brian Coca
3c9890a358 now in v2 everything passes a single passwords hash 2015-04-08 03:17:32 -04:00
James Cammarata
7076298dc1 Adding FIXME note to playbook executor code regarding password params 2015-04-06 22:27:14 -05:00
Brian Coca
d732c94ac2 a bunch of updates to connection info and related, to pass down passwords
also now options populate required fields in required order allowing play to override
added capture of debug in action plugins when stdout is not json
2015-04-06 22:35:02 -04:00
James Cammarata
e82ba723e2 Fixing multiple v2 bugs 2015-04-05 01:07:47 -05:00
Brian Coca
4bc79a746a more fine tunnign on verbosity 2015-04-04 16:26:05 -04:00
Brian Coca
b1e6aaa790 implemented verbosity, added 5th level and now can see how many plays per playbooko if -vvvvv 2015-04-04 15:54:54 -04:00
Brian Coca
5531b84360 moved ad-hoc to use display 2015-04-04 15:21:42 -04:00
Brian Coca
af97e732a0 updated ansible-playbook to use display, fixed issues breaking display class 2015-04-04 15:14:40 -04:00
Brian Coca
e6e69c0894 finished implementing list-hosts, started adding list-tasks/list-tags
but getting just task names and have to adjust for having blocks.
2015-04-04 10:25:55 -04:00
Brian Coca
2eb2a41d05 renamed get_entries to get_plays 2015-04-04 10:24:03 -04:00
Toshio Kuratomi
349ecf6efe Add a vault test to data_loader test and some additional yaml tests to parsing/yaml/test_loader 2015-04-03 11:39:56 -07:00
Brian Coca
3c6fdebfe3 made listhosts play output name more consistent internally 2015-04-03 13:49:00 -04:00
Brian Coca
a811c8841e now listhosts shows the same info as v1 2015-04-03 13:42:05 -04:00
James Cammarata
41d9bfde07 Moving the Display() instantiation outside of v2 classes 2015-04-03 12:17:01 -05:00
Brian Coca
ada86dafaf added listhosts draft
fixed assert from list to new yaml ansible object
taskqueue is now None when just listing
2015-04-03 13:02:42 -04:00
Brian Coca
e719bf765d switched to use cross platform os.sep, added diff output to copy 2015-04-03 09:20:19 -04:00
Brian Coca
20b4492704 started implementing 'list options' 2015-04-03 04:51:16 -04:00
Brian Coca
2ade17e2f5 v2 changed empty inventory to warning that only localhost is available 2015-04-03 04:50:44 -04:00
Brian Coca
0f8bc038ec changed to use display as utils.warning doesnt exist in v2 2015-04-03 00:25:09 -04:00
Brian Coca
25f071b64c fixed called to find plugin, transport is not needed as suffixes are passed 2015-04-03 00:01:32 -04:00
Brian Coca
7a81167b06 brought v2 find plugins up 2 date with v1, also added exception handling for whne there is a permissions issue 2015-04-02 23:59:48 -04:00
James Cammarata
469a1250b6 Moving new patch action plugin over to v2 2015-04-02 16:22:07 -05:00
Brian Coca
ee1af1b14e Merge pull request #10559 from bcoca/become_constants_fix
removed folding sudo/su to become logic from constants
2015-04-02 15:51:58 -04:00
Toshio Kuratomi
5808b68d35 Update module pointers 2015-04-02 12:41:30 -07:00
Toshio Kuratomi
2cddb093f5 Add AnsibleList for keeping track of line numbers in lists parsed from yaml 2015-04-02 12:37:02 -07:00
Toshio Kuratomi
369bf0d214 No longer need AnsibleComposer 2015-04-02 12:35:50 -07:00
Toshio Kuratomi
d277c6b821 Few more py3 cleanups 2015-04-02 11:41:18 -07:00
Toshio Kuratomi
ac6b7045db A little py3 compat, side effect of making this work under profile 2015-04-02 11:41:13 -07:00
Toshio Kuratomi
bfae708bbf Port v2 to the PyYAML C extension 2015-04-02 11:21:55 -07:00
James Cammarata
811a906332 Fixing the synchronize action plugin for v2 2015-04-02 11:54:45 -05:00
James Cammarata
34aba2dd9a Fixing dupe option for -u in v2 2015-04-02 11:26:42 -05:00
James Cammarata
0603b9c62c Merge branch 'v2_fixing' into devel
Conflicts:
	v2/ansible/playbook/helpers.py
2015-04-02 01:25:53 -05:00
James Cammarata
785c0c0c8c V2 fixing bugs 2015-04-02 01:19:21 -05:00
Toshio Kuratomi
69cf95bd0e Add __init__ to the yaml test dir 2015-04-01 15:00:50 -07:00
Toshio Kuratomi
e697de6076 Move AnsibleBaseBaseYAMLObject's position_info into a property 2015-04-01 14:54:22 -07:00
Toshio Kuratomi
05f1bed12b Use the node's start_mark to determine line and column.
* Elminates a lot of logic in the AnsibleComposer class.
* Update tests with new column offsets.  The rule should now be
  consistently: Column is the start of the entry's value (so for
  strings, the first non-space after the entry beginning, for dicts, the
  first character of the first key)
2015-04-01 13:51:01 -07:00
Toshio Kuratomi
b152275a36 Test line numbers and "fix" a bug in the scalar line counting 2015-04-01 12:18:53 -07:00
Toshio Kuratomi
4a5b37542d Merge pull request #10579 from ansible/v2-unicode-yaml
Change AnsibleConstructor for yaml to only return unicode strings
2015-04-01 09:39:53 -07:00
Toshio Kuratomi
c41b917162 Add a yaml constructor for unicode strings:
* Changes AnsibleConstructor so that only unicode strings are returned
  (no str type)
* Tracks line, column numbers for strings
* Adds unittests for AnsibleLoader (generic for all the yaml parsing)
2015-04-01 09:37:54 -07: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
Monty Taylor
90ca386555 Add api timeout now that shade spports it everywhere 2015-03-31 20:29:06 -04:00
Toshio Kuratomi
eb788dd8f6 Just move things around so that new_inventory doesn't interfere with testing 2015-03-31 12:58:00 -07:00
Toshio Kuratomi
378dc561cb Possible fix for the first newline and triple newline problems 2015-03-30 22:47:56 -07:00
Toshio Kuratomi
43c1a97447 Various unicode and backslash escape cleanups
* Do backslash escape parsing in parse_kv() [was being done in the copy
  module purely for newlines in the copy module's content param before]
* Make parse_kv always return unicode
* Add bandaid to transform args to unicode until we can fix things
  calling parse_kv to always send it unicode.
* Make split_args deal with unicode internally.  Warning, no bandaid for
  things calling split_args without giving it unicode (shouldn't matter
  as dealt with str internally before)
* Fix copy and unarchive action plugins to not use setdefaultencoding
* Remove escaping from copy (it was broken and made content into latin-1
  sometimes). escaping is now in parse_kv.
* Expect that content is now a unicode string so transform to bytes just
  before writing to the file.
* Add initial unittests for split_args and parse_kv.  4 failing
  tests.because split_args is injecting extra newlines.
2015-03-30 19:19:34 -07:00
Toshio Kuratomi
1cc2135a0d Fix no closed parens 2015-03-30 19:15:41 -07:00
Toshio Kuratomi
4aa3ac41a1 Port sivel's fix for egg_info (#10563) to v2 2015-03-30 19:15:41 -07:00
Toshio Kuratomi
ce512e18f0 Remove fireball connection plugin. v2 will have accelerate but not fireball 2015-03-30 19:15:41 -07:00
Toshio Kuratomi
dc9b36ccb0 Some notes on optimizing module_replacer 2015-03-30 19:15:41 -07:00
Brian Coca
5ec1f3bd6e removed folding sudo/su to become logic from constants as it is already present downstream in playbook/play/tasks 2015-03-27 08:45:04 -04:00
Toshio Kuratomi
0ec1b025a9 Update the module pointers 2015-03-26 11:59:53 -07:00
Toshio Kuratomi
ea2d00c558 v2 equivalent for https://github.com/ansible/ansible/pull/8564
Looks like there's currently no code for the ansible_*_interpreter but
modified the note abouot adding it
2015-03-26 11:57:27 -07:00
Toshio Kuratomi
60f972dfe4 Fix the command module handling of non-ascii values.
We can't depend on the args being unicode text because we're in module
land, not in the ansible controller land
2015-03-25 13:57:48 -07:00
Toshio Kuratomi
38892e986e Convert exceptions to unicode using to_unicode rather than str. that stops unicode errors if the string has non-ascii text 2015-03-25 13:56:46 -07:00
Toshio Kuratomi
131683523b Add some comments to explain how the property code for Attributes works 2015-03-23 23:16:06 -07:00
Brian Coca
8a0b8629e8 readded -u option 2015-03-24 00:18:04 -04:00
Toshio Kuratomi
bc69ad8147 Rename munge methods to preprocess_data.
Remove the call to preprocess_loop data from playbook_include as
includes can't be used with loops.
2015-03-23 18:42:28 -07:00
Toshio Kuratomi
6ba24e9fa1 Remove comment on changing Base.munge => it's used by become.py 2015-03-23 17:41:02 -07:00
Toshio Kuratomi
63c54035de Get rid of iteritems usage when we only care about the keys 2015-03-23 16:38:51 -07:00
Toshio Kuratomi
fdf51e9a96 Use class.mro() instead of custom base_class finder code 2015-03-23 16:14:34 -07:00
James Cammarata
79cf7e7292 Modifying sample for test_become to show more test cases 2015-03-23 15:22:34 -05:00
Toshio Kuratomi
095990b4d8 Moving from getattr to properties for the v2 base class 2015-03-23 15:19:13 -05:00
Toshio Kuratomi
7115d37933 Merge pull request #10518 from pilou-/file_mode_v2
Port #10258 to v2
2015-03-22 19:56:03 -07:00
Pierre-Louis Bonicoli
5942144868 Port #10258 to v2 2015-03-23 01:25:18 +01:00
James Cammarata
bda83fdf84 Fixing bug in v2 dynamic include code, pointed out by apollo13 2015-03-22 19:17:25 -05:00
Brian Coca
c5d5ed17ea added tag resolution mirroring updated v1 2015-03-22 02:05:27 -04:00
Brian Coca
ca540ef9f8 added vault password to dataloder creation 2015-03-21 01:33:10 -04:00
Brian Coca
08896e2cfd enabled vault password file and fixed prompting for connection password on local 2015-03-21 01:23:28 -04:00
Brian Coca
edb1bd25dd added password prompting and become/sudo/su collapsing 2015-03-21 01:19:07 -04:00
Brian Coca
9d3a63945d moved pipeline check to class var that was previouslly added 2015-03-21 00:48:38 -04:00
Brian Coca
b370728439 several fixes to cli tools
- fixed issue with previous commit with bad constants vs C ref on become
- added list-tags
- rearranged common options to utils/cli.py
- added generic validate for both vault and become conflicts
- removed dupes and conflicting options
2015-03-21 00:40:24 -04:00
James Cammarata
93c9803818 Removing some leftover debug prints and cleaning up test sample 2015-03-20 23:25:21 -05:00
Brian Coca
cf96c7719e added become_method list and pipeline support to connection class methods
added generic method to check supported become methods for the connection plugin
2015-03-20 23:48:52 -04:00
Brian Coca
c7c8425856 fixed command line PE options to be the same as in 1.9 2015-03-20 23:12:16 -04:00
James Cammarata
393246fdd3 Make v2 playbook class attributes inheritable
Also fixing some other become-related things
2015-03-20 14:15:12 -05:00
Toshio Kuratomi
b186676e38 Clean up jsonify and make json_dict_*to* more flexible at the same time. 2015-03-20 11:35:19 -07:00
James Cammarata
3473a3bbec Changes to become cmd formatting, per a47c132 2015-03-17 10:50:41 -05:00
James Cammarata
316284c56b Making blocks support become, and cleaning up sudo/su references 2015-03-17 10:35:46 -05:00
Toshio Kuratomi
caf2a96ef9 Merge pdksh fix to v2 2015-03-15 13:22:07 -07:00
James Cammarata
22304afd1d More fixing of become stuff in v2 2015-03-13 15:31:20 -05:00
Toshio Kuratomi
70f56c135c Port #10357 to v2 2015-03-13 11:44:58 -07:00
James Cammarata
070c7c319f Started implementing become in v2 2015-03-13 11:58:00 -05:00
James Cammarata
b1d78a61fc Initial support for vault in v2
TODO:
* password prompting needs to be implemented, but is being worked on
  as part of the become privilege escalation changes
2015-03-12 12:14:57 -05:00
Toshio Kuratomi
ee831e1071 Fix v2 for #10426
Note: In v1 we fix this by transforming into unicode just before we use
it (when we send it to jinja2) because jinja2 cannot handle non-ascii
characters in str.

In v2 our model is that all text values need to be stored as unicode
type internally.  So we transform this to unicode when we read it from
the inventory file and save it into the internal dict instead.
2015-03-11 21:28:45 -07: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
Toshio Kuratomi
983b617fb7 Update the modules 2015-03-04 18:56:50 -08:00
James Cammarata
ca4c5a14bb Fixing bug related to dynamic includes + with* loops 2015-03-04 13:52:32 -06:00
James Cammarata
d0cfcdbc4d Getting dynamic includes working a bit better on v2 2015-03-04 13:52:31 -06:00
James Cammarata
f12695f287 Add run_once/BYPASS_HOST_LOOP feature in v2 2015-03-04 13:52:31 -06:00
James Cammarata
4af2d0a907 Reworking v2 play iterator and fixing some other bugs
Still not working quite right:
* dynamic includes are not adding the included tasks yet
* running roles with tags not quite working right
2015-03-04 13:52:31 -06:00
Brian Coca
618722ddee fixed function call to proper number of params 2015-03-04 09:43:13 -05:00
Toshio Kuratomi
07a7353a2c Port changes from #10372 fixing checksumming on csh and backslashes in filenames to v2 2015-03-02 16:08:08 -08:00
Brian Coca
893f1326fc Merge pull request #10114 from bcoca/v2_url_lookup
v2: added draft url lookup
2015-02-26 23:53:07 -05:00
Brian Coca
5a64b2e269 Merge pull request #10305 from bcoca/cartesian
Cartesian
2015-02-26 23:25:33 -05:00
Toshio Kuratomi
825dd25d43 Update module pointers 2015-02-26 13:52:10 -08:00