network.managed reports changes when nothing changed.
Description of Issue/Question
Salt is reporting changes from network.managed without actually changing something.
Setup
the test state:
lo:ldap:
network.managed:
- type: eth
- proto: static
- netmask: 255.255.255.255
- ipaddr: 192.168.67.138
Steps to Reproduce Issue
(Include debug logs if possible and relevant.)
performing the state via state.sls the first time I receive the following report (whitespace removed):
local:
----------
ID: lo:ldap
Function: network.managed
Result: True
Comment: Interface lo:ldap updated.
Started: 16:45:05.731539
Duration: 349.411 ms
Changes:
----------
interface:
---
+++
@@ -1,5 +1,5 @@
auto lo:ldap
iface lo:ldap inet static
- address 127.0.10.0
- netmask 255.255.255.0
+ address 192.168.67.138
+ netmask 255.255.255.255
status:
Interface lo:ldap is up
Summary for local
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
That is o.k. so far, because obviously there were real changes. if I call the same state a second time, the result is:
local:
----------
ID: lo:ldap
Function: network.managed
Result: True
Comment: Interface lo:ldap is up to date.
Started: 16:45:10.728423
Duration: 340.26 ms
Changes:
----------
status:
Interface lo:ldap is up
Summary for local
------------
Succeeded: 1 (changed=1)
Failed: 0
------------
Total states run: 1
There is a change reported without actually changing something. I have tested this with another minion running a much older version (2014.1.13) and the result was:
local:
----------
ID: lo:ldap
Function: network.managed
Result: True
Comment: Interface lo:ldap is up to date.
Changes:
Summary
------------
Succeeded: 1
Failed: 0
------------
Total: 1
That is pretty much what I expected to be reported.
Versions Report
salt-Master version 2016.3.0 (for both minions) salt-minion version 2016.3.0 (unexpected change report) salt-minion version 2014.1.13 (expected behaviour) all running on Debian 8.
@grmpfatwork i am able to replicate this. I am seeing it on 2014.7, 2015.8, and 2016.3
My test case was using the following sls file:
ens0:
network.managed:
- enabled: True
- type: eth
I think the problem here is not necessarily what is really changed but the interface is really made up.
As you can see here, it tries to bring up an interface and we really don't know it's up successfully or not without checking the return of __salt__['ip.up'](name, type) or any other validations.
Thus Interface foo:bar is up is misleading. I think we need more info from @grmpfatwork to see after the first run of the statefile lo:ldap is really up or not.
From the code itself, I think the first run doesn't make the interface up and second run up still tries to bring the down interface to be up. That's why the status message has Interface lo:ldap is up