fix(pillar): fix OverflowError: Range too big -- MAX_RANGE (100000)

https://gitlab.com/myii/prometheus-formula/-/jobs/1077740890#L779

```
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/salt/utils/templates.py", line 501, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/dist-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/dist-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 212, in top-level template code
  File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 462, in call
    return __context.call(__obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/jinja2/sandbox.py", line 173, in safe_range
    raise OverflowError(
OverflowError: Range too big. The sandbox blocks ranges larger than MAX_RANGE (100000).

; line 212

---
[...]
   skip_verify: true

  linux:
    # 'Alternatives system' priority: zero disables (default)
    # yamllint disable-line rule:braces
    altpriority: {{ range(1, 9100000) | random }}    <======================
```
This commit is contained in:
Imran Iqbal 2021-03-07 00:44:31 +00:00
parent a7875aea8a
commit c9cfdfd9e1
No known key found for this signature in database
GPG Key ID: 6D8629439D2B7819
3 changed files with 3 additions and 3 deletions

View File

@ -204,7 +204,7 @@ prometheus:
linux: linux:
# 'Alternatives system' priority: zero disables (default) # 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces # yamllint disable-line rule:braces
altpriority: {{ range(1, 9100000) | random }} altpriority: {{ range(1, 100000) | random }}
tofs: tofs:
# The files_switch key serves as a selector for alternative # The files_switch key serves as a selector for alternative

View File

@ -209,7 +209,7 @@ prometheus:
linux: linux:
# 'Alternatives system' priority: zero disables (default) # 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces # yamllint disable-line rule:braces
altpriority: {{ range(1, 9100000) | random }} altpriority: {{ range(1, 100000) | random }}
tofs: tofs:
# The files_switch key serves as a selector for alternative # The files_switch key serves as a selector for alternative

View File

@ -164,7 +164,7 @@ prometheus:
linux: linux:
# 'Alternatives system' priority: zero disables (default) # 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces # yamllint disable-line rule:braces
altpriority: {{ range(1, 9100000) | random }} altpriority: {{ range(1, 100000) | random }}
tofs: tofs:
# The files_switch key serves as a selector for alternative # The files_switch key serves as a selector for alternative