Commit graph

15 commits

Author SHA1 Message Date
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
89e450ff7e Example - Removed unnecessary add_host 2022-09-04 11:41:52 +02:00
5ef2ffc55c Debugging support
* Support for dumping parsed programs as strings (both a basic,
    repr-like version and an indented version that is easier to read)
  * Display the parsed program if verbosity is high enough
  * Program tracing if verbosity is high enough
2022-09-04 11:35:07 +02:00
7b44cdc731 create_group - add_host and parent options
* The `add_host` option can be used to add the current host to the
    group being created. It avoids having to use a separate `add_host`
    instruction in this case.
  * The `parent` option can specify the parent group. It avoids having
    to use a separate `add_child` instruction in this case.
2022-09-03 10:43:01 +02:00
9d7ea81783 README updated to mention blocks 2022-09-02 20:29:40 +02:00
5f719d7ab8 "block" instruction implemented
The "block" instruction allows mulitple instructions to be grouped in
order to be executed based on a single condition, in a common loop, with
a local variable scope. In addition, it provides a way to recover from
errors.
2022-09-02 20:26:36 +02:00
d658089183 README and COPYING files added 2022-09-02 18:25:52 +02:00
17aa8e8c46 Initial import of the WIP plugin 2022-09-02 18:00:22 +02:00