telmich/cdist — Issue #13: __key_value fails if initial value contains metacharacters
Author: phrawzty
Created: 2012-01-09 17:15:28+00:00
State: open

The `awk` command which performs the essential function of `__key_value` will fail if the _initial_ value contains metacharacters. For example :

```
# manifest
__key_value logtarget --value '/var/log/foo.log' --file 'file.cfg' --delimiter '='
```

```
# file.cfg
logtarget=/var/log/bar.log
```
This will end up generating an awk gsub string that contains the following :

```
[...] {gsub(//var/log/thing.log/, "/var/log/foo.log")} [...]
```
The first element is clearly illegal and will result in a syntax failure from `awk`.

A solution is to replace the slashes which surround the first element at line 43 of `/conf/type/__key_value/gencode-remote` with double-quotes, as is already the case with the second element. Is there any particular reason why slashes are preferred here over double-quotes ?