Commit Graph

45 Commits (dca36c1d16064b24adfa14b417eb71637b960b96)

Author SHA1 Message Date
James Cammarata ce3ef7f4c1 Making the switch to v2 2015-05-03 21:47:26 -05:00
Toshio Kuratomi 084fbbdea9 Reverse the conditional so there's one less return from this function 2015-02-26 22:50:11 -08:00
Alvaro Lopez Ortega 2e929cf0ce Fixes bug #10281 - Trailing zeros were truncated from strings 2015-02-21 19:54:38 +01:00
Alvaro Lopez Ortega a14248ffe1 Fixes bug #10281 - Trailing zeros were truncated from strings 2015-02-21 16:40:50 +01:00
Thomas Quinot 23d959db71 Report location (filename and line number) for inventory syntax errors
When AnsibleError is raised for a syntax error in an inventory file,
report filename and line number to help pinpointing the error.
2014-11-30 10:41:09 +01:00
Serge van Ginderachter 0ceefbbf29 inventory ini parser: do not add all the groups to *all* group
but only those with lowest depth, so we keep a proper tree structure
2014-03-25 12:45:00 +01:00
Oleg Bulatov f6a4c20cc0 Make parsing variables for hosts and groups more consistent
This commit allows to specify arrays in [group:vars] block.

Signed-off-by: Oleg Bulatov <oleg@bulatov.me>
2014-03-16 21:47:26 +04:00
Cristian Ciupitu 0749112286 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-16 13:10:28 -04:00
Richard C Isaacson 16fe09eef8 Fixes related to uncommenting test_dir_inventory in TestInventory.
0. Uncomment the test.
1. Test fails.
2. Make vars unique per file in test inventory files.
3. Modify token addition to not ast.literal_eval(v) a variable containing a hash.
4. Modify vars to have an escape in test inventory file.
5. Catch exceptions explicitly. Any unknown exceptions should be a bug.
6. Test passes.
2014-03-06 12:09:53 -06:00
Michael DeHaan 94a7fb60fe Allow escaped comments in inventory files. 2014-03-05 20:10:25 -05:00
Richard C Isaacson b41d8106ff Revert "Merge pull request #6287 from risaacson/fix_hash_in_var"
This reverts commit a808287451, reversing
changes made to 6129ea7566.
2014-03-05 14:49:30 -06:00
Richard C Isaacson 38abd5e20e Break this out into a reusable function and document regex shortcomings. 2014-03-05 10:50:58 -06:00
Richard C Isaacson 49bd8b0b35 Fix inventory for test_dir_inventory
It came up that fixing this unit test may relate to another ticket that is open. This work allows us to uncomment this unit test by fixing how we pars variables allowing a quoted variable to contain a '#'.

Work also went into cleaning up some of the test data to clarify what was working.

Lastly work went into cleaning up formatting so that the code is easily read.
2014-03-04 18:31:49 -06:00
Ilya Kuznetsov 0658847ea6 Allow equal sign in single-line ini variables 2014-02-14 20:04:23 +07:00
jctanner 59d99c17b3 Merge pull request #5337 from bob-smith/bugfixFQDNParsing
Fix inventory parsing so that FQDN can be parsed without throwing ssh port error
2014-01-14 08:28:38 -08:00
Michael DeHaan 10350d1639 Update various copyrights. Not complete, but sufficient. 2014-01-04 13:32:04 -05:00
John Barker 4bf9f714d0 Fix inventory parsing so that FQDN can be parsed without throwing ssh
port parsing errors
Fixes problesm introduced by 948d019fef
Adds testcases to defend
2013-12-18 21:33:05 +00:00
Martynas Mickevicius 7ecb5fbc9c Handle comment on inventory group line. 2013-10-17 13:16:35 +03:00
Martynas Mickevicius 44279ce34f Allow leading ranges in the inventory host entries. 2013-10-17 13:16:35 +03:00
James Cammarata 948d019fef Detect IPv6 addresses in INI inventory
Prevents parts of the IPv6 address from being interpreted as a port
(for example, :80).

Fixes #3888
2013-10-09 11:11:09 -05:00
James Cammarata bff47df5ff Fix issue with ast evaluation of strings 2013-10-01 09:20:48 -05:00
Brian Coca 771435deb4 now ini vars are typed
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-09-26 18:29:17 -04:00
Brian Coca a937a6a66d now bad ini entries will throw friendlier error
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
2013-08-07 12:49:12 -04:00
rishid d18c90ed8f Add support for INI comments that begin with '#' or ';'
Ini file format does not have a standard but ';' is used more often than '#' for comments
2013-08-06 11:41:07 -04:00
Rike-Benjamin Schuppner 71afb9e432 Use with guard for file reads. 2013-06-10 17:16:31 +02:00
Pol Llovet 4432c01ceb Handle '#' in var strings by splitting on ' #'
If someone has a " #" in a quoted var string, it
will interpret that as a comment and refuse to
load the inventory file due to an unbalanced
quote. Noisy failure > unexpected behavior.
2013-05-31 12:34:45 -06:00
Pol Llovet ba78360c52 Remove inline comments from inventory tokenizing. 2013-05-30 14:12:23 -06:00
Seth Vidal 2796b5ee2a simple fix for issue 2564
when we encounter a group we've not seen before - we need
to make sure we make it a subgroup of 'all', no matter what
2013-04-04 12:44:39 -04:00
Daniel Hokka Zakrisson 647cd0141c Move all inventory script code into the script parser 2013-03-01 23:22:52 +01:00
Nigel Metheringham c0e28762f0 Allow end of line comments in inventory file
See github issue 2702
https://github.com/ansible/ansible/issues/2072
2013-02-13 14:15:22 +00:00
Michael DeHaan 4bcdd24688 Merge pull request #1776 from junegunn/inventory-group-var-ws
Allows whitespaces around assignment operators when defining group variables
2012-12-17 16:51:49 -08:00
Junegunn Choi 8896486606 Adds comments on handling quoted group vars 2012-12-16 10:32:05 +09:00
Junegunn Choi 7fbb7e079a Fix hostname expansion bug in inventory parser 2012-12-16 01:49:12 +09:00
Junegunn Choi daf797804b Allows whitespaces around assignment operators
when defining group variables
2012-12-14 20:43:29 +09:00
Daniel Hokka Zakrisson 0c70abfaa9 Make sure any existing groups gets reused 2012-11-25 12:42:30 +01:00
Daniel Hokka Zakrisson 5504f13c68 Create groups in the first run through the file
Fixes #1208.
2012-11-25 01:00:14 +01:00
Michael DeHaan f140332ff6 Make it possible in the inventory file to have spaces in host variables 2012-08-30 19:51:46 -04:00
Dave Peticolas 08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan faed4b5a33 whitespace + remove deprecated YAML parser (migration script lives in examples/scripts and warning was added
in 0.6 release)
2012-08-06 20:07:02 -04:00
Ahmad Khayyat 6728b6cdda Allow = symbols in variable values in host inventory 2012-07-31 23:36:26 -04:00
Chin Fang e3b2521f01 Added a host expansion feature to ansible's inventory parsing 2012-07-24 12:38:52 -07:00
Michael DeHaan 5a67a556cd Script to migrate YAML users to the INI format, so we can deprecate YAML inventory (which we are now doing). 2012-07-20 11:15:57 -04:00
Michael DeHaan 1754de3335 Misc code cleanup, mostly whitespace preferences, removing unused imports, plus a few fixes here and there. 2012-07-15 12:29:53 -04:00
Michael DeHaan 68a9adc1be Indentation cleanup (partial) 2012-07-15 09:32:47 -04:00
Michael DeHaan cf9ddf3a30 Reorganizing file structure. Not done. 2012-05-25 19:34:13 -04:00