Commit df3cfda
committed
Fix shell_escape of unless command
A bug was introduced in 74ea1de .
It resulted in an error:
```
Error: /Stage[main]/Java::Config/Exec[create-java-alternatives]: Could not evaluate:
Could not find command 'alternatives\'
```
The effective exec was:
```puppet
exec{'create-java-alternatives':
path => '/usr/bin:/usr/sbin:/bin:/sbi
command => ['alternatives', '--install', '/usr/bin/java', 'java', $java::use_java_alternative_path, '20000'],
unless => shell_escape("alternatives --display java | grep -q $java::use_java_alternative_path}"),
}
```
This errors since the spaces inside the `shell_escape` are also escaped to `\ `.
This patch only shell_escapes the external supplied string
`java::java_alternative_path` which was I expect the object the exercise.
Configuration to trigger the bug, but it should not be hard.
```
class{'java':
distribution => 'jdk',
java_alternative => '/usr/lib/jvm/java-11-openjdk/bin/java',
java_alternative_path => '/usr/lib/jvm/java-11-openjdk/bin/java',
java_home => '/usr/lib/jvm/java-11-openjdk/',
package => 'java-11-openjdk-devel',
version => 'present',
}
```1 parent 245185b commit df3cfda
2 files changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
| |||
0 commit comments