launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30271
[Merge] ~cjwatson/launchpad:charm-cibuild-config-ensure-json into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:charm-cibuild-config-ensure-json into launchpad:master.
Commit message:
charm: Ensure that cibuild.* config items are rendered as JSON
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/447170
Just dumping out dicts and lists directly into the buildd-manager configuration file doesn't necessarily quite work, because `lp.code.model.cibuildbehaviour` loads them as JSON which has different quoting requirements.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:charm-cibuild-config-ensure-json into launchpad:master.
diff --git a/charm/launchpad-buildd-manager/reactive/launchpad-buildd-manager.py b/charm/launchpad-buildd-manager/reactive/launchpad-buildd-manager.py
index 708a4a5..2f1b033 100644
--- a/charm/launchpad-buildd-manager/reactive/launchpad-buildd-manager.py
+++ b/charm/launchpad-buildd-manager/reactive/launchpad-buildd-manager.py
@@ -2,6 +2,7 @@
# GNU Affero General Public License version 3 (see the file LICENSE).
import base64
+import json
import os.path
import subprocess
@@ -98,6 +99,7 @@ def configure():
base.base_dir(), "buildd-manager"
)
config["cibuild_config"] = yaml.safe_load(config["cibuild_config"])
+ config["json"] = json
host.mkdir(
config["buildd_manager_dir"],
owner=base.user(),
diff --git a/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf b/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
index d09009c..ddf9fbd 100644
--- a/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
+++ b/charm/launchpad-buildd-manager/templates/launchpad-buildd-manager-lazr.conf
@@ -29,7 +29,7 @@ vm_resume_command: ssh -o StrictHostKeyChecking=no -i /home/{{ user }}/.ssh/buil
{% for pillar, config in cibuild_config.items() -%}
[cibuild.{{ pillar }}]
{%- for key, value in config.items() %}
-{{ key }}: {{ value }}
+{{ key }}: {{ json.dumps(value) }}
{%- endfor %}
{%- endfor %}
{% endif %}