Commit 55a003f
committed
Parse deferred templates twice
Currently it is not possible to have a template file.epp
```puppet
<%- |
Stdlib::Port $port,
String[1] $password,
| %>
port <%= $port %>
password <%= $password %>
```
and run
```puppet
file{'/tmp/junk':
content => stdlib::deferrable_epp('module/file.epp', { 'port' => '1234', pass => Deferred('secrets::get',['mysecret'])}),
}
```
since the deferred template substitution will fail:
```
Error: Failed to apply catalog: Evaluation Error: Resource type not found: Stdlib::Port (file: inlined-epp-text, line: 2, column: 3)
```
due to Stdlib::Port not being available on the agent node.
This change now parses the EPP twice. The first pass will reduce the
template to:
```puppet
port = 1234
password <%= $password %>
```
and this simpler template will be passed in deferred mode.
Note the original template type for password must accept the
intermediate generated value of `<%= $password %>` which is typically
case for a secret password.1 parent d871c4d commit 55a003f
File tree
3 files changed
+95
-15
lines changed- functions
- spec/functions
3 files changed
+95
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3173 | 3173 | | |
3174 | 3174 | | |
3175 | 3175 | | |
3176 | | - | |
3177 | | - | |
3178 | | - | |
3179 | | - | |
3180 | | - | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
3181 | 3191 | | |
3182 | 3192 | | |
3183 | 3193 | | |
3184 | 3194 | | |
3185 | | - | |
3186 | | - | |
3187 | | - | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
3188 | 3208 | | |
3189 | 3209 | | |
3190 | 3210 | | |
| |||
3200 | 3220 | | |
3201 | 3221 | | |
3202 | 3222 | | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
3203 | 3229 | | |
3204 | 3230 | | |
3205 | 3231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
10 | 35 | | |
11 | 36 | | |
12 | | - | |
| 37 | + | |
13 | 38 | | |
14 | 39 | | |
15 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
29 | 58 | | |
30 | 59 | | |
31 | 60 | | |
0 commit comments