Skip to content

Commit

Permalink
fix: 🐛 Use jinja variable names in place of the nautobot settings names
Browse files Browse the repository at this point in the history
  • Loading branch information
erhansen-cox committed Aug 29, 2023
1 parent a460597 commit f35ef16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@
"postprocessing_subscribed": os.environ.get("POSTPROCESSING_SUBSCRIBED", []),
"jinja_env": {
"undefined": import_string("jinja2.StrictUndefined"),
"jinja_env_trim_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_TRIM_BLOCKS", True)),
"jinja_env_lstrip_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_LSTRIP_BLOCKS", False)),
"trim_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_TRIM_BLOCKS", True)),
"lstrip_blocks": is_truthy(os.getenv("NAUTOBOT_JINJA_ENV_LSTRIP_BLOCKS", False)),
},
# The platform_slug_map maps an arbitrary platform slug to its corresponding parser.
# Use this if the platform slug names in your Nautobot instance don't correspond exactly
Expand Down
10 changes: 5 additions & 5 deletions docs/admin/admin_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ PLUGINS_CONFIG = {
"platform_slug_map": None,
"jinja_env": {
"undefined": StrictUndefined, # jinja2.StrictUndefined
"jinja_env_trim_blocks": True,
"jinja_env_lstrip_blocks": False,
"trim_blocks": True,
"lstrip_blocks": False,
},
# "get_custom_compliance": "my.custom_compliance.func"
},
Expand Down Expand Up @@ -106,7 +106,7 @@ The plugin behavior can be controlled with the following list of settings.
| per_feature_bar_width | 0.15 | 0.15 | The width of the table bar within the overview report |
| per_feature_width | 13 | 13 | The width in inches that the overview table can be. |
| per_feature_height | 4 | 4 | The height in inches that the overview table can be. |
| jinja_env | {"jinja_env_lstrip_blocks": False} | See Note Below | A dictionary of Jinja2 Environment options compatible with Jinja2.SandboxEnvironment() |
| jinja_env | {"lstrip_blocks": False} | See Note Below | A dictionary of Jinja2 Environment options compatible with Jinja2.SandboxEnvironment() |

!!! note
Over time the compliance report will become more dynamic, but for now allow users to configure the `per_*` configs in a way that fits best for them.
Expand All @@ -120,7 +120,7 @@ The plugin behavior can be controlled with the following list of settings.
```python
jinja_env = {
"undefined": import_string("jinja2.StrictUndefined"),
"jinja_env_trim_blocks": True,
"jinja_env_lstrip_blocks": False,
"trim_blocks": True,
"lstrip_blocks": False,
}
```
4 changes: 2 additions & 2 deletions nautobot_golden_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class GoldenConfig(PluginConfig):
"get_custom_compliance": None,
"jinja_env": {
"undefined": StrictUndefined,
"jinja_env_trim_blocks": True,
"jinja_env_lstrip_blocks": False,
"trim_blocks": True,
"lstrip_blocks": False,
},
}

Expand Down

0 comments on commit f35ef16

Please sign in to comment.