Page MenuHomePhabricator

Scap config management: Jinja2 fills templates with Pythonic values
Closed, ResolvedPublic

Description

Scap3 reads in configuration variable values from YAMLs, either from vars.yaml or from the Puppet-compiled file located on the host, and puts them into Python dict()s. On the output side, however, they are forced into strings regardless of the output format used by the actual configuration file, which may result in unexpected values, such as proxy: None instead of proxy: or enableFeature: True instead of enableFeature: true.

A way around this would be to have different output processors which can be specified in config-files.yaml:

/etc/service/config.yaml:
  template: config.yaml.j2
  erb_syntax: True
  output_format: yaml

Then, Scap2 could process all non-string values and turn them into appropriate, valid YAML values (in this example). This would also allow us later expand processing to other configuration-file formats.

Revisions and Commits

Event Timeline

thcipriani triaged this task as Medium priority.Sep 13 2016, 3:18 PM
thcipriani moved this task from Needs triage to Services improvements on the Scap board.
GWicke edited projects, added Services (later); removed Services.

Change 370842 had a related patch set uploaded (by Mobrovac; owner: Mobrovac):
[operations/puppet@production] [UGLY-FIX] EventStreams: Double-quote false to avoid False

https://gerrit.wikimedia.org/r/370842

Change 370842 merged by Elukey:
[operations/puppet@production] [UGLY-FIX] EventStreams: Double-quote false to avoid False

https://gerrit.wikimedia.org/r/370842

thcipriani added a revision: Restricted Differential Revision.Aug 9 2017, 8:05 PM

The fix for this went out with scap 3.7.0-1 on Monday.