saltstack/salt — Issue #654: Unexpected Append Behaviour in 0.96
Author: kaptk2
Created: 2012-02-07 18:14:11+00:00
State: open

When using append a error occurs when using this sls file:
```
/etc/sudoers:
file:
- append
- text:
- Defaults:backuppc !requiretty
- backuppc ALL= NOPASSWD: /usr/bin/rsync
- require:
- pkg: sudo
```

The full traceback is pasted below:

> 11:08:44,045 [salt.state ][INFO ] Executing state file.append for /etc/sudoers
> 11:08:44,046 [cmd ][INFO ] Executing command sed -n -r -e 's/Defaults:backuppc !requiretty/&/gp' /etc/sudoers in > directory /root
> 11:08:44,049 [cmd ][DEBUG ]
> 11:08:44,050 [salt.minion ][WARNING ] The minion function caused an exception: Traceback (most recent call last):
> File "/usr/lib/python2.6/site-packages/salt/minion.py", line 210, in _thread_return
> ret['return'] = self.functions[data['fun']](*data['arg'])
> File "/usr/lib/python2.6/site-packages/salt/modules/state.py", line 79, in highstate
> return st_.call_highstate()
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 1000, in call_highstate
> return self.state.call_high(high)
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 695, in call_high
> ret = self.format_verbosity(self.call_chunks(chunks))
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 531, in call_chunks
> running = self.call_chunk(low, running, chunks)
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 630, in call_chunk
> running = self.call_chunk(low, running, chunks)
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 635, in call_chunk
> running[tag] = self.call(low)
> File "/usr/lib/python2.6/site-packages/salt/state.py", line 515, in call
> ret = self.states[cdata['full']](*cdata['args'])
> File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 1065, in append
> for line in chunk.split('\n'):
> AttributeError: 'dict' object has no attribute 'split'
>
> 11:08:44,051 [salt.minion ][INFO ] Returning information for job: 20120206205737290861

This error can be easily worked around by adding the ' char around the second line. The root issue appears to be that yaml is interpreting the second line as a dict instead of a string.