Juniper / jsnapy

Python version of Junos Snapshot Administrator
Apache License 2.0
115 stars 58 forks source link

Trouble with use JSNAPy from python for more than one devices #384

Closed yurys555 closed 3 months ago

yurys555 commented 3 years ago

Hello! I have an error with this Python code. AttributeError: 'SnapAdmin' object has no attribute 'host_list' What i'm doing wrong?

from jnpr.jsnapy import SnapAdmin from jnpr.junos import Device

js = SnapAdmin()

config_file = """ hosts:

js.snap(config_file, "pre")

Python 3.7.9 jsnapy==1.3.5 junos-eznc==2.5.4

will-mcdermott commented 3 years ago

I had the same issue. The following resolved this for me:

+++ b/lib/jnpr/jsnapy/jsnapy.py @@ -47,6 +47,7 @@ class SnapAdmin:

yurys555 commented 3 years ago

@will-mcdermott Thanks! It's helped.

niklash-dev commented 3 years ago

@will-mcdermott Thank you, I was about to get a headache 👍

chidanandpujar commented 3 months ago

issue is not reproducible in the latest jsnapy verision 1.3.8.dev0, we will close this issue as fixed.

Please refer the following pass logs.

from jnpr.jsnapy import SnapAdmin
from pprint import pprint
from jnpr.junos import Device

js = SnapAdmin()

config_data = """
hosts:
  - device: x.x.x.x
    username : xyz
    passwd: xyz

  - device: x.x.x.x
    username : xyz
    passwd: xyz
tests:
  - test_snmp.yml 
"""

snap = js.snap(config_data, "pre")

python issu_384_mult_dev.py 
Connecting to device x.x.x.x ................
Taking snapshot of RPC: get-configuration
Connecting to device x.x.x.x ................
Taking snapshot of RPC: get-configuration

Thanks Chidanand

chidanandpujar commented 3 months ago

issue is not reproducible in the latest jsnapy verision 1.3.8.dev0, we will close this issue as fixed.

Thanks Chidanand