Skip to content

Regex in Substitute not working #81

@jibz89

Description

@jibz89

NetBox version
What version of NetBox are you currently running?
v4.0.11

Describe the bug
A clear and concise description of what the bug is.
plugin is not adding the substitute to template, it just adds the jinja2 variable name like {{ cisco_exclude_banner }}

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Config Diff Plugin'
  2. Click on 'Platform Settings'
  3. Click on 'Add'
  4. Click 'Platform' choose IOS (if you don't have platform go back to Device and create Platform)
  5. For Driver type in cisco_iosxe
  6. For Command 'show running-config'
  7. Now Click on 'Create' to save Platform Settings
  8. Next under Config Management Click on 'Substitutes'
  9. Click 'Add'
  10. Choose Platform settings create earlier (ex: IOS XE cisco_iosxe)
  11. Name something like 'cisco_exclude_banner'
  12. Regexp 'banner login [\S\s]+^C'
  13. Click 'Create' to save Substitute
  14. Now Click on 'Provisioning' and then 'Config Templates'
  15. Create Template type Name ex: test
  16. Template Code enter the Substitute as jinja2 variable like {% raw %}{{ cisco_exclude_banner }}{% endraw %}
  17. Click on Devices and Edit and Choose the Config template for device (Device must be Active status and have Primary IP and Platform IOS)
  18. Now go back to Config Diff Plugin and Click 'Configuration Requests'
  19. Click 'Add' Find the device and Click 'Create' to Save
  20. Now click on 'Collect diffs'
  21. No Error

Expected behavior
A clear and concise description of what you expected to happen.
the matched config was not added into rendered output instead just the variable gets added {{ cisco_exclude_banner }}

Screenshots
If applicable, add screenshots to help explain your problem.
platforms
rendered diff pic 2
rendered diff
sample_regex_test
sample_regex_test2
sample_regex_test3
substitutes
template

Additional context
Add any other context about the problem here.
sample_text_config.txt

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions