Skip to content

Commit

Permalink
fix(map.jinja): fix error dictionary changed size during iteration
Browse files Browse the repository at this point in the history
* Original PR: #69
* Reference: https://stackoverflow.com/a/36330953
* Error:

```bash
RuntimeError: dictionary changed size during iteration
```
  • Loading branch information
myii committed Dec 7, 2019
1 parent 0f329c5 commit a61a03a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ssf/map.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
{%- set config = salt['config.get'](tplroot, default={}, merge=None) or {} %}

{#- Reduce dict sizes before merging, by removing formulas that aren't active #}
{%- for k, v in defaults[tplroot].semrel_formulas.items() %}
{%- for k, v in defaults[tplroot].semrel_formulas.copy().items() %}
{%- if k not in config.active.semrel_formulas %}
{%- do defaults[tplroot].semrel_formulas.pop(k, None) %}
{%- endif %}
{%- endfor %}
{%- for k, v in formulas[tplroot].semrel_formulas.items() %}
{%- for k, v in formulas[tplroot].semrel_formulas.copy().items() %}
{%- if k not in config.active.semrel_formulas %}
{%- do formulas[tplroot].semrel_formulas.pop(k, None) %}
{%- else %}
{#- Reduce dict sizes further, by removing files that aren't active #}
{%- for f_k, f_v in v.semrel_files.items() %}
{%- for f_k, f_v in v.semrel_files.copy().items() %}
{%- if f_k not in config.active.semrel_files %}
{%- do formulas[tplroot].semrel_formulas[k].semrel_files.pop(f_k, None) %}
{%- endif %}
Expand Down

0 comments on commit a61a03a

Please sign in to comment.