09-17-2019 03:12 PM
Hi,
I'm creating an automation to do automated healing of network device misconfigs. One fix would be for an audit to be able to add back 'ip http active-session-modules none'. I found one article that talked about using the .create() method but I end up with:
>>> with ncs.maapi.single_write_trans('XXXXX', 'python', groups=['XXXXXXXX']) as trans:
... root = ncs.maagic.get_root(t)
... device_cdb = root.devices.device["XXXXXXXXX"]
... device_cdb.config.ios__ip.http.active_session_modules.none.create()
... trans.apply()
...
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/apps/nso/opt/ncs/current/src/ncs/pyapi/ncs/maagic.py", line 1017, in create
if not self._backend.exists(self._path):
File "/apps/nso/opt/ncs/current/src/ncs/pyapi/ncs/maapi.py", line 1175, in proxy
return real(self2.maapi, self2.th, *args, **kwargs)
File "/apps/nso/opt/ncs/current/src/ncs/pyapi/ncs/maapi.py", line 404, in exists
return True if _tm.maapi.exists(self.msock, th, path) else False
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
File "/usr/lib64/python2.7/socket.py", line 170, in _dummy
raise error(EBADF, 'Bad file descriptor')
socket.error: [Errno 9] Bad file descriptor
>>>
09-17-2019 03:15 PM
09-17-2019 03:19 PM
Ah, yep, thank you. I was cutting a pasting from a few different parts of my project. Some parts I use "t", some "trans". That solved the issue!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide