31e5e93d37
Host variables - Add the "all" group if it's not listed
2022-11-05 10:54:53 +01:00
8c0245ed18
Merge group vars into host variables
2022-11-04 13:05:42 +01:00
74e0f92595
Documentation rewrite
2022-11-01 10:31:14 +01:00
3f38940a9c
Restructured into a collection
2022-10-07 22:29:53 +02:00
ae58080401
Unit tests - get_templated_group()
2022-10-07 17:04:35 +02:00
9f4bcd8228
Unit tests for the runtime parts of abstract instructions
2022-10-07 17:03:53 +02:00
3c461e84c6
Fixed type check
2022-10-07 16:51:14 +02:00
2bc5dd04d7
Removed useless function argument
2022-10-07 15:28:39 +02:00
0001c775d6
Set available variables before evaluating the condition
2022-10-07 15:21:41 +02:00
8ec5f57f6e
Abstract instruction tests - parse_group_name() method
2022-10-01 16:50:29 +02:00
6e9bfe42c9
Abstract instruction tests - parse_run_once() function
2022-10-01 16:32:32 +02:00
1609d5828d
Abstract instruction tests - parse_vars()
2022-10-01 15:39:14 +02:00
3b20355ca9
Abstract instruction tests - parse_loop()
2022-10-01 15:07:38 +02:00
3431f2b3f2
Abstract instruction tests - parse(), parse_condition()
2022-10-01 14:38:43 +02:00
44253014de
Abstract instruction tests - dump()
2022-10-01 13:14:50 +02:00
f1c02012a2
Made instruction representation tests more independant
2022-10-01 13:06:43 +02:00
ddc6b775ae
Abstract instruction tests - repr()
2022-10-01 12:24:50 +02:00
3ff7ab51eb
Don't crash if repr()/dump() are used before parse()
2022-10-01 12:03:29 +02:00
28f1d3308a
Refactored main parse method
2022-09-18 17:57:21 +02:00
4a56566c58
Use pre-commit with black + yamllint
...
* Added pre-commit config
* Added yamllint config
* Updated example YAML files to match the yamllint config
* black'd existing Python code
2022-09-18 17:32:23 +02:00
7ea55e277e
Depend on ansible-core instead of ansible
2022-09-18 12:17:43 +02:00
3d0fcb76d2
Unit tests for the variable storage class
2022-09-18 12:15:03 +02:00
f42df48a1b
Don't reset the cache on pop if no deletion occurs
...
When the stack is being pop'd, it is not necessary to reset it if no
variable is either reset to its previous value or deleted.
2022-09-18 12:12:59 +02:00
91a90def13
Use copy.copy() instead of the copy() method, which might not exist
2022-09-18 11:51:06 +02:00
14ea834823
Fixed MutableMapping import source
2022-09-18 10:33:00 +02:00
cf4462da91
README updated to mention vars
2022-09-18 10:16:53 +02:00
47a2704164
locals clause removed from block instruction
2022-09-18 10:13:51 +02:00
fcdfe9241d
Vars added to debugging output
2022-09-18 10:13:37 +02:00
f2d1e2da50
Implemented vars clause
...
* Can be used on any instruction
* Variables are evaluated before condition is checked
2022-09-18 10:06:19 +02:00
2fd5ba9bb4
Sorted instruction definitions
2022-09-18 09:45:38 +02:00
446280ab6e
run_once clause
...
When the run_once clause is present and set to a truthy value, the
instruction it is attached to will only be executed the first time it is
encountered.
2022-09-17 12:22:40 +02:00
14fca45cb7
Refactoring - run_once() renamed to run_iteration()
2022-09-17 12:06:21 +02:00
6b58f873a9
More code documentation
2022-09-17 12:01:06 +02:00
285cf74195
Code documentation - Variable cache
2022-09-17 10:51:35 +02:00
0f03f5d539
Don't reset the variable cache if nothing changes on pop()
2022-09-17 10:47:45 +02:00
6ca723c74e
Doc update regarding variables' behavior
2022-09-17 10:30:37 +02:00
9c4cc09021
Copy variables when storing them on the stack
2022-09-17 10:21:06 +02:00
0519be9316
Changed how variables work again
...
Script variables are not longer saved before entering a block. Only
variables declared as locals and loop variables are saved. This allows a
block to use `set_var` to change a variable.
2022-09-17 10:10:18 +02:00
46e675dedb
Cleaner implementation of the variable cache
...
* Separate implementation that acts as a MutableMapping
* I'm still not sure about this. Also, there is a design error in
there, because it's not possible to "return" a value from a block
unless it's written to a fact.
2022-09-07 21:24:07 +02:00
b79e9f8faf
Some comments
2022-09-04 23:44:02 +02:00
cbe1bd65bf
loop - Always process the value using the templar
...
* When the loop value is a list, its items may be templates or
structures which contain templates. Because of that, they need to go
through the templar.
2022-09-04 23:37:01 +02:00
91ff8296d6
More cache/loop fixes
...
* When the loop variable state is restored, the cache must also be
modified.
* What needs to be done depends on whether a host fact by the same
name also exist.
* Fuck that cache thing. It's going away next time I can hack on this.
2022-09-04 23:20:26 +02:00
57bf02e79d
Variable cache - Reset after block execution
...
* When a block is done executing, local variables must be restored to
their previous values ; however, host variables may have been
updated inside the block. Therefore it is necessary to reset the
variable cache.
2022-09-04 23:16:56 +02:00
d1d997f7ae
Actually use the variable cache
...
* The merged (host+local) variable cache should not be reset at each
instruction.
2022-09-04 23:14:01 +02:00
7e5eb8e414
Fixed caching problem in set_fact
...
* Since facts have a lower priority than local variables, set_fact
should only update the cache if no local variable uses the same
name
2022-09-04 23:00:15 +02:00
a5b1ac5c4c
Better loop variable state handling
...
* Loops caused local scripts variables to be backed up then restored,
which would have caused a set_var in a loop to have no effect.
* Instead, we back up the state of the variable (existing or not,
value) and either restore the original value or delete the variable
if it didn't exist.
2022-09-04 22:54:03 +02:00
1b1c1281a2
Use abc for the instruction class and its abstract methods
2022-09-04 22:44:06 +02:00
c587f1479c
Fixed weird indentation
2022-09-04 12:21:09 +02:00
36477385a1
Changed the long debugging output for loop/when
2022-09-04 12:20:49 +02:00
cc439110ae
Remove allowed field names from instruction data
...
* It's pointless to have a distinct set of allowed fields for each
instruction in the program
2022-09-04 11:50:42 +02:00