Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsnap2py indentation fix #416

Closed
wants to merge 2 commits into from

Conversation

chidanandpujar
Copy link
Collaborator

@chidanandpujar chidanandpujar commented Jun 12, 2024

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
Copy link
Collaborator Author

closing this pull request, wrong file operator.py added

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

Successfully merging this pull request may close these issues.

1 participant