Skip to content

Commit

Permalink
fix unsafe jinja use of __class__
Browse files Browse the repository at this point in the history
  • Loading branch information
hwhesselink committed Mar 6, 2021
1 parent 814d0e8 commit 6942101
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions snmp/macros.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
{%- macro v12c_communities(mode, proto='') -%}
{% set communities = conf.get(mode+'communities'+proto, []) -%}
{%- for community in communities %}
{%- if communities.__class__ == {}.__class__ and communities.get(community, {}) is mapping %}
{%- if isinstance(communities, dict) and communities.get(community, {}) is mapping %}
{%- set source = communities.get(community).get('source', '') %}
{%- set view = communities.get(community).get('view', None) %}
{%- else %}
{%- set source = '' %}
{%- set view = '' %}
{%- endif %}
{%- if not source.__class__ in (().__class__, [].__class__) %}
{%- if not isinstance(source, (tuple, list)) %}
{%- set source = [source] %}
{%- endif %}
{%- for src in source -%}
Expand Down

0 comments on commit 6942101

Please sign in to comment.