Skip to content
  • Thomas Bellman's avatar
    4421c300
    rh_interface: Purge interfaces better on ensure=>absent. · 4421c300
    Thomas Bellman authored
    Some improvements on removing interface configuration (i.e. setting
    the ensure parameter to 'absent').
    
    First, the grep(1) pattern for checking if the interface was up, did
    not catch all cases.  In particular, it only checked for "state UP";
    it did not check for "UP" in the flags.  Fix that.
    
    Second, make sure to remove all IP addresses from the interface.  Just
    taking down the link retains the addresses on the interface, which can
    cause clashes.
    
    Third, if the interface was a bridge interface, delete the bridge using
    'brctl delbr'.  Else, the interfaces connected to the bridge as ports
    will not be usable as IP interfaces.
    
    Fourth, if it was a VLAN interface, remove it from the VLAN config
    using 'ip link del ... type vlan'.
    
    And finally, ensure the order between removing sysconfig files, taking
    down the interface, and restarting the network service.  Otherwise, we
    could get to the situation that the interface was taken down, then the
    network service would bring it up again because the sysconfig files
    were still there, and only after that would the files be removed.
    
    This should lead to more reliable operations when removing interfaces.
    However, in the time between taking down the interface, and restarting
    the network service, the network on the node may be broken.  If Puppet
    tries to evaluate other resources in that period, something that is
    very likely with any non-trivial set of manifests, they might fail.
    But at least now we should have a working network at the end of the
    Puppet run; that was not the case before these changes.
    
    This was originally commit 99a546cafc06 in nsc-puppet-utils.
    4421c300
    rh_interface: Purge interfaces better on ensure=>absent.
    Thomas Bellman authored
    Some improvements on removing interface configuration (i.e. setting
    the ensure parameter to 'absent').
    
    First, the grep(1) pattern for checking if the interface was up, did
    not catch all cases.  In particular, it only checked for "state UP";
    it did not check for "UP" in the flags.  Fix that.
    
    Second, make sure to remove all IP addresses from the interface.  Just
    taking down the link retains the addresses on the interface, which can
    cause clashes.
    
    Third, if the interface was a bridge interface, delete the bridge using
    'brctl delbr'.  Else, the interfaces connected to the bridge as ports
    will not be usable as IP interfaces.
    
    Fourth, if it was a VLAN interface, remove it from the VLAN config
    using 'ip link del ... type vlan'.
    
    And finally, ensure the order between removing sysconfig files, taking
    down the interface, and restarting the network service.  Otherwise, we
    could get to the situation that the interface was taken down, then the
    network service would bring it up again because the sysconfig files
    were still there, and only after that would the files be removed.
    
    This should lead to more reliable operations when removing interfaces.
    However, in the time between taking down the interface, and restarting
    the network service, the network on the node may be broken.  If Puppet
    tries to evaluate other resources in that period, something that is
    very likely with any non-trivial set of manifests, they might fail.
    But at least now we should have a working network at the end of the
    Puppet run; that was not the case before these changes.
    
    This was originally commit 99a546cafc06 in nsc-puppet-utils.
Loading