Repository navigation
Closed
Labels
P2Priority 2PlatformRelates to OS, containers, platform-based utilities like FS, system based appsState-Modulebugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone
Description
I'm trying to use the network module on a Fedora 17 host with a very simple config, using salt 0.16.3 on both the master and minion. The interface applies correctly, but the network.system fails.
/srv/base/net/init.sls:
system:
network.system:
- enabled: true
- hostname: myhost.someplace.com
- gateway: 10.198.19.254
- gatewaydev: eth0
- nozeroconf: true
- requires_reboot: true
eth0:
network.managed:
- enabled: true
- type: eth
- proto: none
- ipaddr: 10.198.16.45
- netmask: 255.255.252.0
- dns:
- 10.192.0.1
- 10.209.0.233
This seems to match the online documentation pretty precisely, however, when I try to apply the state to the host, I get the following error:
myhost.someplace.com:
State: - network
Name: eth0
Function: managed
Result: True
Comment: Interface eth0 is up to date.
Changes:
State: - network
Name: system
Function: system
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 1237, in call
*cdata['args'], **cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/states/network.py", line 350, in system
new = __salt__['ip.build_network_settings'](**kwargs)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 1017, in build_network_settings
opts = _parse_network_settings(settings, current_network_settings)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 682, in _parse_network_settings
_raise_error_network('networking', valid)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 732, in _raise_error_network
msg = _error_msg_network(option, expected)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 98, in _error_msg_network
return msg.format(option, '|'.join(expected))
TypeError: sequence item 4: expected string, bool found
Changes:
Metadata
Metadata
Assignees
Labels
P2Priority 2PlatformRelates to OS, containers, platform-based utilities like FS, system based appsState-Modulebugbroken, incorrect, or confusing behaviorfixed-pls-verifyfix is linked, bug author to confirm fixseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
basepi commentedon Aug 27, 2013
So even though we return an error, the settings were actually applied properly? This is probably a sorting issue in the expected-vs-found settings comparison, plus a small type mismatch (the bool error). Shouldn't be too difficult to fix.
Thanks for the report!
smithjm commentedon Aug 27, 2013
Actually, the error is on "network.system" which I don't think actually gets applied. However, the "network.managed" portion applies correctly (defining eth0). Thanks!
smithjm commentedon Aug 28, 2013
Interestingly, when I comment out the three lines that have boolean values like so:
I still get:
smithjm commentedon Aug 28, 2013
I have now successfully configured a much more complex host, using bonded interfaces, vlan bonding, and a bridge, without errors (by commenting out the entire network.system section and managing /etc/sysconfig/network by hand). This confirms two things:
smithjm commentedon Dec 4, 2013
Just wanted to confirm I'm still seeing this in 0.17.2, against both Fedora 17 and Fedora 19:
system:
network.system:
- enabled: True
- hostname: {{ grains['fqdn'] }}
- gateway: {{ gwinfo['gateway'] }}
- gatewaydev: {{ gwdev }}
- nozeroconf: True
- requires_reboot: True
renders on one of my minions to:
system:
network.system:
- enabled: true
- hostname: somename.our.domain.com
- gateway: 10.0.0.1
- gatewaydev: eth0
- nozeroconf: True
- requires_reboot: True
which in turn generates:
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1278, in call
_cdata['args'], *_cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/states/network.py", line 348, in system
new = salt'ip.build_network_settings'
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 1041, in build_network_settings
opts = _parse_network_settings(settings, current_network_settings)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 684, in _parse_network_settings
_raise_error_network('networking', valid)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 734, in _raise_error_network
msg = _error_msg_network(option, expected)
File "/usr/lib/python2.7/site-packages/salt/modules/rh_ip.py", line 100, in _error_msg_network
return msg.format(option, '|'.join(expected))
TypeError: sequence item 4: expected string, bool found
The rest of the network state still applies correctly as before, but the 'network.system' state does not apply.
sroegner commentedon Jan 14, 2014
I had the same problem on CentOS 6 and was able to work around it - replace
- enabled: True
with
- networking: True
and the state will be applied as expected
cachedout commentedon May 16, 2014
I can no longer replicate this bug in 2014.1.4. I would like to close this unless there are more recent reports of this failing.
The-Loeki commentedon May 28, 2015
Replicatable on Ubuntu 14.04 w/ salt 2015.5 and no
/etc/default/networkingfile;Cause of the trace
The trace is caused because
CONFIG_TRUEand/orCONFIG_FALSEare passed on to theexpectedvar; These contain actual boolsTrue/False, tripping over the'|'.join.@rallytime / @cachedout: Putting those two bools behind quotes fixes the trace, but I'm very far from sure those aren't needed for value testing.
The alternative would of course be something like
'|'.join([str(expect) for expect in expected]).Also, I haven't checked the other
ipmodulesCause of the cause of the trace
_parse_current_network_settingsinitializesopts['networking'] = '', then proceeds to look forCONFIGURE_INTERFACESin/etc/default/networking.Hence if that file or that var in that file can't be read, the value will be wrong and the message will be thrown.
Properly of course it'd contain
FalseorTruedepending on your world view of things, which leads to my aforementioned note of value testing (in which case it probably would need to be'True'or'False')As a side note, setting
- networking: Truedoesn't make a difference for me; I have to fill theCONFIGURE_INTERFACESwith something validThe-Loeki commentedon Jul 3, 2015
@rallytime bump?
rallytime commentedon Jul 3, 2015
@The-Loeki Since the code has changed so much since 2014.1.4 and 2015.5 (and since @cachedout wasn't able to reproduce it) I suspect this might be something different/new. Would you mind opening a new request with all of the details you posted above?
The-Loeki commentedon Jul 6, 2015
@rallytime: The cause of the trace lies in the fact that the
CONFIG_TRUEandCONFIG_FALSEvariables containboolTrue/False; they trip over'|'.join. This hasn't changed and is the direct cause of all these traces wheneverCONFIG_TRUEorCONFIG_FALSEare tested.AFAIK this behaviour is the same on at least 2014+, and the same piece of code exists in both
rhipanddebian_ip.Now as to why that test is triggered is a different discussion and an apparent semi-rarity; the one I documented is again reproducable with little to no reason to assume this has changed between 2014.1 and 2015.5
Also, although it's a different platform, notice the problem here is exactly the same; check
network.systemtrips up violently if not provided with aboolsomewhere in the config files; the only difference is that sroegners workaround (a formula-configured override) works for RHEL's, and not for Debians.All in all there's two different components to this problem which need addressing; the
'|'.joinshould deal withbooland/or theboolvals need to become a string (I would've patched, but I can't tell which one is the most reasonable here),and, since
/etc/default/networkingcan not be assumed to be there this shouldn't be cause for a trace but rather for a sensible (formula-supplied?) default or a decent error message.8 remaining items
dsnopek commentedon Mar 29, 2017
I'm seeing this issue with a very simple state that actually comes straight from the examples in the documentation:
This is on Debian 8 with Salt 2016.11.3
dsnopek commentedon Mar 29, 2017
Er, went through the stack trace which is this:
And found that this was a failed attempt to build an error message. The actual error appears to be no value for the 'networking' option, which I guess comes from 'enabled' in the state. If I change my state to:
... then it doesn't error out! (Still haven't tested if it does what I want yet, though.) This could probably use a documentation fix!
nixjdm commentedon Aug 11, 2017
I'm not sure what all
enabledis doing for network.system, but it does seem necessary. Adding that line fixes the issue for me. The docs definitely need updated ifenabledis truly necessary, with an explanation. Or else the code needs fixed if it shouldn't really be required.lastmikoi commentedon Feb 5, 2018
Just stumbled upon that issue under
2016.11.9, I had an empty/etc/sysconfig/networkout of a cloud-init instance and it kept failing. @dsnopek's workaround worked perfectly but not before I lost a lot of time trying to troubleshoot that issue on my own :). Having either the docs or the code updated to reflect that behaviour would definitively be helpful.eliasp commentedon Sep 26, 2018
Still applies to
2018.3.2on Ubuntu 18.04, where it can be easily reproduced using:Resulting in:
waynew commentedon Jan 28, 2019
Just pushed a fix for the error message producing a stack trace.
cr1st1p commentedon Oct 23, 2019
Salt version 2019.2.0, ubuntu 18.04
Same problem as @dsnopek .
I have a simple state, as documented, to set the hostname. It crashes with the same stacktrace.
If I add the 'enabled: True', it says:
The problems:
waynew commentedon Jan 24, 2020
@cr1st1p can you check the neon RC?
waynew commentedon Feb 28, 2020
@cr1st1p I'm going to go ahead and close this for now - if this error is still happening with Salt v3000 please let me know and I'll re-open.
kbaikov commentedon Nov 15, 2020
@rallytime @waynew this error is still happening with Salt 3002.1 on ubuntu 20.04
Fails with the following message:
ID: system
Function: network.system
Result: False
Comment: Invalid network setting -- Setting: networking, Expected: [yes|on|true|1|True|no|off|false|0|False]
Unless enabled: True is added as per comment: #6922 (comment)
rallytime commentedon Nov 16, 2020
Hi @kbaikov - Thanks for the ping! I am no longer involved with the Salt project, so unfortunately I can't reopen this.
@waynew Can you take a look here?
omgitsedwin commentedon Mar 25, 2021
Can confirm error still exists on Ubuntu 18.04 on Salt 3002.6.