saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14k stars 5.47k forks source link

LXC config wants to strip() everything (even an int value) #19055

Closed achamo closed 9 years ago

achamo commented 9 years ago

Hi,

I think there is something wrong with lxc.edited_conf. My state looks like this :

lxc-conf:
  lxc.edited_conf:
    - name: mycontainers
    - lxc_conf:
        - lxc.network.type: veth
        - lxc.network.flags: up
        - lxc.network.link: br0
        - lxc.network.ipv4: 1.1.1.1/28
        - lxc.network.mtu: 4200

And when applied

[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1533, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/states/lxc.py", line 132, in edited_conf
    lxc_conf_unset=lxc_conf_unset)
  File "/usr/lib/python2.7/dist-packages/salt/modules/lxc.py", line 1833, in update_lxc_conf
    row[conf].strip()))
AttributeError: 'int' object has no attribute 'strip'

I guess Yaml parses an int and the code expects a string. An easy trick could be to quote the mtu value but it doesn't seem right :)

# salt-minion --version
salt-minion 2014.7.0 (Helium)
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
terminalmage commented 9 years ago

Thanks, I'll get this fixed. As a temporary workaround, you can quote that MTU value, but we should be able to handle this without users having to do that.