salt icon indicating copy to clipboard operation
salt copied to clipboard

netconfig.managed commits config on Cisco IOS in the presence of test=True

Open dractyl opened this issue 7 years ago • 13 comments

Description of Issue

I have two netconfig.managed stanzas for a particular switch. With test=True on the command line, the first instance respects it and does not commit, while the second instance ignores test=True and commits the config.

Setup

I need to delete the switch config specific stuff, but I don't see that as relevant to this issue anyway.

SLS file:
cisco_basic_switch_config:
  netconfig.managed:
    - template_name: salt://{{ slspath }}/files/switch.jinja

cisco_individual_switch_config:
  netconfig.managed:
    - template_name: salt://{{ slspath }}/files/individual_config.jinja

When executed, cisco_basic_switch_config works properly and does not commit but then cisco_individual_switch_config runs and unexpectedly does.

This happened during a production maintenance window, so the flurry of unexpected log messages was something of a surprise.

We're moving to collapse these two configs into one, but neither the contents of the configs nor the fact that there are two should result in test=True being ignored.

FWIW, the configs are non-overlapping (one handles interfaces and the other, everything else)

Steps to Reproduce Issue

I have not attempted to reproduce as my maintenance window has passed, but here is the command and its output (with switch config specifics removed; I'm offering what I can even if it's an imperfect bug report):

salt 'switch-a' state.apply test=True

switch-a:
----------
          ID: cisco_basic_switch_config
    Function: netconfig.managed
      Result: None
     Comment: Configuration discarded.
              
              Configuration diff:

< A diff of what would have been done >
              
     Started: 05:41:18.578389
    Duration: 18581.07 ms
     Changes:   
              ----------
              diff:
 < The same diff of what would have been done, a bit verbosely perhaps >
---------
          ID: cisco_individual_switch_config
    Function: netconfig.managed
      Result: True
     Comment: Configuration changed!
     Started: 05:41:37.159805
    Duration: 14933.766 ms
     Changes:   
              ----------
              diff:

< A diff of actual changes that it actually did >

Summary for switch-a
------------
Succeeded: 2 (unchanged=1, changed=2)
Failed:    0
------------
Total states run:     2
Total run time:  33.515 s

I can give this another go in our maintenance window, two weeks from now.

Versions Report

On the master:

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.12.3
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
   python-gnupg: 0.4.1
         PyYAML: 5.1.1
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5
 
System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-36-generic
         system: Linux
        version: Ubuntu 18.04 bionic

On the Proxy:

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: 1.12.3
       cherrypy: Not Installed
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
   python-gnupg: 0.4.1
         PyYAML: 5.1.1
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5
 
System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-52-generic
         system: Linux
        version: Ubuntu 18.04 bionic

dractyl avatar Jun 27 '19 07:06 dractyl

I'm having this same issue right now in EOS, not even passing test: True to the state itself is being respected.

raddessi avatar Feb 28 '20 23:02 raddessi

@dmurphy18

sagetherage avatar Apr 21 '20 18:04 sagetherage

https://github.com/saltstack/salt/pull/56299 may have resolved this, can someone check if behaviour has changed?

raddessi avatar Sep 04 '20 17:09 raddessi

@raddessi I am seeing if there is someone who can test it this week, holiday this past Monday in US is making it a bit limited, but letting you know I am working on it!

#56299 may have resolved this, can someone check if behaviour has changed?

sagetherage avatar Sep 09 '20 18:09 sagetherage

@raddessi Do you have a sample configuration which demonstrates the issue on EOS. I have access to some Virtual EOS machines which I can test against.

dmurphy18 avatar May 07 '21 21:05 dmurphy18

Any config should show the issue, as long as there is a config change, running with test=True would still apply changes. I don't have a config I can easily copy I'm afraid.

raddessi avatar May 07 '21 22:05 raddessi

We just finished updating to 3002.6 however, I'll check this some time next week and get back to you.

raddessi avatar May 07 '21 22:05 raddessi

@raddessi Any update on this with Arista. @dractyl Sorry for talking so long to get back to you on this. Are you still experiencing the problem, also what version of Cisco router are you using, recently got access to IOS-XR and IOS-XE.

Lastly presuming you are using Napalm, have you taken pre-cautions in config that Napalm documents about using config ? https://napalm.readthedocs.io/en/latest/support/ios.html

dmurphy18 avatar Jun 15 '21 23:06 dmurphy18

We stopped using salt for network tasks immediately after the incident (this is not the kind of excitement we can have in production) and the last of our Cisco devices are scheduled to be put to a well-earned death in the next couple of months.

So we’re no longer exposed to this bug for reasons both unfortunate and joyous, respectively.

On Jun 16, 2021, at 8:04, David Murphy @.@.>> wrote:

@raddessihttps://github.com/raddessi Any update on this with Arista. @dractylhttps://github.com/dractyl Sorry for talking so long to get back to you on this. Are you still experiencing the problem, also what version of Cisco router are you using, recently got access to IOS-XR and IOS-XE.

Lastly presuming you are using Napalm, have you taken pre-cautions in config that Napalm documents about using config ? https://napalm.readthedocs.io/en/latest/support/ios.html

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/saltstack/salt/issues/53619#issuecomment-861889714, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ALWIAHMV6D7CENQEBP2UTITTS7L7TANCNFSM4H3Y4J3Q.

dractyl avatar Jun 16 '21 10:06 dractyl

@raddessi Can you open a separate issue detailing the problems you are encountering with Arista, including versions of Salt, Napalm and the Arista platform in use.

@dractyl If this is okay with you, I would like to close this issue since you are moving away from Cisco and further debug it with @raddessi and the Arista platform, which I have ample access to various versions of vEOS. I will ensure that the solution also includes tests for Cisco. It would also be good to know which version of Cisco routers OS you are using, given that Napalm utilizes different libraries to communicate with the Cisco router.

dmurphy18 avatar Jun 16 '21 16:06 dmurphy18

Sorry, work has been busy. I can try to get some time for this soon, and yes I can open a new issue and link back here.

In case you didn't see it however, I hope https://github.com/saltstack/salt/pull/56299 fixed the issue.

raddessi avatar Jun 16 '21 16:06 raddessi

Example of my failure was in https://github.com/saltstack/salt/issues/56289

raddessi avatar Jun 16 '21 16:06 raddessi

Closing this issue as PR #56299 appears to address the issue

dmurphy18 avatar Jun 24 '21 15:06 dmurphy18