Reverse the order of nested templates. (#531)
authorJeff Wong <awole20@gmail.com>
Mon, 5 Apr 2021 16:13:53 +0000 (06:13 -1000)
committerGitHub <noreply@github.com>
Mon, 5 Apr 2021 16:13:53 +0000 (09:13 -0700)
Reverses the order of nested template declaration.

This way templates that depend nested templates over the same
hook are ensured to run in the proper order.

Ensures consistency of run-order template includes, for both
base yml files, and nested template yml

eg:

base.yml
```
templates:
  - "templates/template1.yml"
hooks:
  after_code:
    - exec: cat "/tmp/file_made_from_template1.yml.txt"
```

template1.yml
```
templates:
  - "templates/template2.yml"
hooks:
  after_code:
    - exec: cat "/tmp/file_made_from_template2.yml.txt"
    - exec: echo "data from template1" > /tmp/file_made_from_template1.yml.txt
```

template2.yml
```
hooks:
  after_code:
    - exec: echo "data from template2" > /tmp/file_made_from_template2.yml.txt
```

launcher

index d5a6e4c3c2b13c6d78fae7b0eb3cb77f48d5fd76..173a1d62c4f80f365a8c2b1ab327e61e8776d54b 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -280,7 +280,7 @@ find_templates() {
         local nested_templates=$(find_templates $template)
 
         if [ ! -z "$nested_templates" ]; then
-          templates="$templates $nested_templates"
+          templates="$nested_templates $templates"
         fi
       done