Juniper / jsnapy

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

jsnap2py indentation fix #416

Closed chidanandpujar closed 3 months ago

chidanandpujar commented 3 months ago

What does this PR do?

fix for following exceptions.

at line number 30, indentation was wrong at line number 123, method len is not member of object map.

What issues does this PR fix or reference?

Fix for issue #327

Previous Behavior

$ jsnap2py --version File "/usr/bin/jsnap2py", line 30 msg = "{{%s_%s}}" % (data) ^ TabError: inconsistent use of tabs and spaces in indentation

New Behavior

jsnap2py -i test_is_equal.conf -o test_ospf.yml

Tests written?

Yes/No Yes

cat test_is_equal.conf 
do {
      check_ospf;
}

check_ospf {
      command  show configuration protocols ospf ;
      item route-engine {
           is-equal mastership-state, "master" {
             info "Checking if RE0 is the Master RE ...";
             err " ERROR: RE0 is not the Master RE. Its current state is %s", $POST/mastership-state;
          }
      }
}

jsnap2py -i test_is_equal.conf -o test_ospf.yml

cat test_ospf.yml 
check_ospf:
- command: 'show configuration protocols ospf '
- item:
    tests:
    - err: ' ERROR: RE0 is not the Master RE. Its current state is {{post["mastership-state"]}}'
      info: Checking if RE0 is the Master RE ...
      is-equal: mastership-state, master
    xpath: route-engine
tests_include:
- check_ospf
chidanandpujar commented 3 months ago

closing this pull request, wrong file operator.py added