Upgraded my Salt Test environment from 2014.1.0 to 2014.1.1 and have one state that fails. Worked fine under 2014.1.0.
I wrote a simple state to append some entries to root's .bashrc file:
awsbashrc:
file.blockreplace:
- name: /root/.bashrc
- marker_start: "# START salt-managed content - salt-cloud state -DO-NOT-EDIT"
- marker_end: "# END salt-managed content - salt-cloud state -DO-NOT-EDIT"
- content: |
export AWSPEM="/root/.ssh/salttest-aws.pem"
complete -C aws_completer aws
alias showwest2="aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Placement.AvailabilityZone, State.Name, InstanceId]' --profile or"
alias showeast1="aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Placement.AvailabilityZone, State.Name, InstanceId]' --profile va"
- append_if_not_found: True
When I try to "salt-call state.sls" the state file, I get this:
ID: awsbashrc
Function: file.blockreplace
Name: /root/.bashrc
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1372, in call
self.verify_ret(ret)
File "/usr/lib64/python2.6/contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/lib/python2.6/site-packages/salt/utils/context.py", line 43, in func_globals_inject
yield
File "/usr/lib/python2.6/site-packages/salt/state.py", line 1371, in call
**cdata['kwargs'])
File "/usr/lib/python2.6/site-packages/salt/states/file.py", line 2123, in blockreplace
show_changes=show_changes
File "/usr/lib/python2.6/site-packages/salt/modules/file.py", line 1146, in blockreplace
if not new_file[-1].ends_with('\n'):
AttributeError: 'str' object has no attribute 'ends_with'
Changes:
When asked about the issue on the Salt mailing list, Ollie Walsh said:
Open an issue for this. The method is called 'endswith' not 'ends_with'.
Verison info:
[root@mymaster salt-cloud]# salt --versions-report
Salt: 2014.1.1
Python: 2.6.6 (r266:84292, Nov 22 2013, 12:16:22)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.1.13
msgpack-pure: Not Installed
pycrypto: 2.0.1
PyYAML: 3.10
PyZMQ: 2.2.0.1
ZMQ: 3.2.4
Upgraded my Salt Test environment from 2014.1.0 to 2014.1.1 and have one state that fails. Worked fine under 2014.1.0.
I wrote a simple state to append some entries to root's .bashrc file:
When I try to "salt-call state.sls" the state file, I get this:
When asked about the issue on the Salt mailing list, Ollie Walsh said:
Verison info: