[BUG] network.managed bonding slaves
See original GitHub issueDescription When creating a bond interface with slaves after the first run we get a the following error.
ID: bond1
Function: network.managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1981, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1977, in wrapper
return f(*args, **kwargs)
File "/var/cache/salt/minion/extmods/states/network.py", line 523, in managed
desired_slaves = kwargs['slaves'].split()
AttributeError: 'list' object has no attribute 'split'
Started: 14:28:30.762470
Duration: 71.795 ms
Changes:
Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info).
eth0:
network.managed:
- enabled: True
- type: slave
- mtu: 1500
- master: bond1
eth1:
network.managed:
- enabled: True
- type: slave
- mtu: 1500
- master: bond1
bond1:
network.managed:
- type: bond
- mode: 802.3ad
- proto: none
- enabled: True
- slaves: eth0 eth1
- require:
- network: eth0
- network: eth1
- miimon: 100
- arp_interval: 250
- downdelay: 200
- lacp_rate: fast
- max_bonds: 1
- updelay: 0
- use_carrier: on
- hashing-algorithm: layer2
- mtu: 1500
- autoneg: on
Steps to Reproduce the behavior (Include debug logs if possible and relevant)
salt 'hypervisor01' state.apply
Expected behavior
ID: bond1
Function: network.managed
Result: True
Comment: Interface bond1 is up to date.
Started: 14:33:54.299361
Duration: 74.395 ms
Changes:
Why to resolve After logging the KWARGS I found that the ‘slaves’ is in a list for some strange reason.
{u'slaves': [u'ens1f0', u'ens1f1'], u'updelay': 0, u'test': False, u'autoneg': True, u'use_carrier': True, u'mode': u'802.3ad'}
I changed the following lines
515a516
> log.warn(kwargs)
522c523,526
< desired_slaves = kwargs['slaves'].split()
---
> if isinstance(kwargs['slaves'], str):
> desired_slaves = kwargs['slaves'].split()
> else:
> desired_slaves = kwargs['slaves']
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.) ``` Salt Version: Salt: 3000.3Dependency Versions: cffi: 1.6.0 cherrypy: Not Installed dateutil: 1.5 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.7.2 libgit2: 0.26.3 M2Crypto: 0.31.0 Mako: Not Installed msgpack-pure: Not Installed msgpack-python: 0.6.2 mysql-python: Not Installed pycparser: 2.14 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.26.4 Python: 2.7.5 (default, Apr 2 2020, 13:16:51) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.3.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4
System Versions: dist: centos 7.8.2003 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1127.el7.x86_64 system: Linux version: CentOS Linux 7.8.2003 Core
</details>
**Additional context**
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
It was fixed in 4f889c1799c5291f1664db116604893e83283b06
@sagetherage if my test is correct, this mean the target for
Aluminium
was, involuntary, reached.Ok, I wrote the #59988 but while testing it I saw that this bug seems to be fixed sometime between
3000.3
and3003
.I just built a new virtual machine with CentOS and install Salt with these commands:
Created a
bond.sls
state:The first run results:
The second run results:
It looks like it’s all working fine.
salt --versions-report
Salt Version: Salt: 3003Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: Not Installed docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 2.11.1 libgit2: Not Installed M2Crypto: 0.35.2 Mako: Not Installed msgpack: 0.6.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: Not Installed pycrypto: Not Installed pycryptodome: Not Installed pygit2: Not Installed Python: 3.6.8 (default, Nov 16 2020, 16:55:22) python-gnupg: Not Installed PyYAML: 3.13 PyZMQ: 17.0.0 smmap: Not Installed timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.1.4
System Versions: dist: centos 7 Core locale: UTF-8 machine: x86_64 release: 3.10.0-1160.15.2.el7.x86_64 system: Linux version: CentOS Linux 7 Core