Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Config lock not released in some error cases #148

Closed
bewing opened this issue Mar 9, 2017 · 1 comment · Fixed by #149
Closed

Config lock not released in some error cases #148

bewing opened this issue Mar 9, 2017 · 1 comment · Fixed by #149
Assignees
Milestone

Comments

@bewing
Copy link
Member

bewing commented Mar 9, 2017

Description of Issue/Question

See topic. Will submit PR to resolve.

Setup

This was tested in a virtual salt environtment.

napalm-eos version

(Paste verbatim output from pip freeze | grep napalm-eos between quotes below)

root@saltmaster:/srv/pillar# pip freeze | grep napalm
napalm-base==0.23.0
napalm-eos==0.5.5

Steps to Reproduce the Issue

Create a config session lock
Error out in a new and interesting way, in a thread
Retry your earlier effort, and see that the config is still locked.

Error Traceback

(Paste the complete traceback of the exception between quotes below)

root@saltmaster:/srv/pillar# salt veos2 test.ping
veos2:
    True
root@saltmaster:/srv/pillar# salt veos2 net.load_config "non-existant file"
veos2:
    ----------
    already_configured:
        True
    comment:
        Cannot execute "load_merge_candidate" on veos2 as admin. Reason: [Errno 2] No such file or directory: 'non-existant file'!
        Configuration discarded.
    loaded_config:
    out:
        ----------
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/salt/proxy/napalm.py", line 294, in call
            out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params)  # calls the method with the specified parameters
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 183, in load_merge_candidate
            self._load_config(filename, config, False)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 150, in _load_config
            with open(filename, 'r') as f:
        IOError: [Errno 2] No such file or directory: 'non-existant file'
root@saltmaster:/srv/pillar# salt veos2 net.load_config "non-existant file"
veos2:
    ----------
    already_configured:
        True
    comment:
        Cannot execute "load_merge_candidate" on veos2 as admin. Reason: Session is already in use by napalm!
        Configuration discarded.
    diff:
    loaded_config:
    result:
        False
    traceback:
        Traceback (most recent call last):
          File "/usr/lib/python2.7/dist-packages/salt/proxy/napalm.py", line 294, in call
            out = getattr(NETWORK_DEVICE.get('DRIVER'), method)(**params)  # calls the method with the specified parameters
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 183, in load_merge_candidate
            self._load_config(filename, config, False)
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 140, in _load_config
            self._lock()
          File "/usr/local/lib/python2.7/dist-packages/napalm_eos/eos.py", line 131, in _lock
            raise SessionLockedException('Session is already in use by napalm')
        SessionLockedException: Session is already in use by napalm
root@saltmaster:/srv/pillar# ssh admin@veos2
The authenticity of host 'veos2 (192.168.50.12)' can't be established.
RSA key fingerprint is 4d:2c:4b:06:5b:be:68:3e:39:b0:22:bd:b3:b9:67:6f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'veos2,192.168.50.12' (RSA) to the list of known hosts.
Password: 
Last login: Mon Mar  6 22:57:42 2017 from 192.168.50.10
veos2#show configuration sessions 
Maximum number of completed sessions: 1
Maximum number of pending sessions: 5

  Name    State       User    Terminal 
  ---- ----------- ---------- -------- 

veos2#exit
Connection to veos2 closed.
@mirceaulinic
Copy link
Member

The PR that screwed this up: #134

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants