summaryrefslogtreecommitdiff
path: root/cloudinit/config/schema.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-09-20 23:41:22 -0600
committerChad Smith <chad.smith@canonical.com>2017-09-20 23:41:22 -0600
commit27613443139578dd1b968d1f5f953bd2bc6245a4 (patch)
treeb9f68975b4a264d2cae499f0a4ef7d345113ca78 /cloudinit/config/schema.py
parentd3a8777244ebc107e1124c4fab441b5e0eb75f44 (diff)
downloadvyos-cloud-init-27613443139578dd1b968d1f5f953bd2bc6245a4.tar.gz
vyos-cloud-init-27613443139578dd1b968d1f5f953bd2bc6245a4.zip
docs: fix sphinx module schema documentation
Create a copy of each modules schema attribute when generating sphinx docs to avoid altering the actual module dict in memory. This avoids illegible rendering of module examples and distros where each character of a list was represented on a separate line by itself. Fixes ntp, resizefs, runcmd and bootcmd docs.
Diffstat (limited to 'cloudinit/config/schema.py')
-rw-r--r--cloudinit/config/schema.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/config/schema.py b/cloudinit/config/schema.py
index c17d973e..bb291ff8 100644
--- a/cloudinit/config/schema.py
+++ b/cloudinit/config/schema.py
@@ -8,6 +8,7 @@ from cloudinit.util import find_modules, read_file_or_url
import argparse
from collections import defaultdict
+from copy import deepcopy
import logging
import os
import re
@@ -273,12 +274,13 @@ def get_schema_doc(schema):
@param schema: Dict of jsonschema to render.
@raise KeyError: If schema lacks an expected key.
"""
- schema['property_doc'] = _get_property_doc(schema)
- schema['examples'] = _get_schema_examples(schema)
- schema['distros'] = ', '.join(schema['distros'])
+ schema_copy = deepcopy(schema)
+ schema_copy['property_doc'] = _get_property_doc(schema)
+ schema_copy['examples'] = _get_schema_examples(schema)
+ schema_copy['distros'] = ', '.join(schema['distros'])
# Need an underbar of the same length as the name
- schema['title_underbar'] = re.sub(r'.', '-', schema['name'])
- return SCHEMA_DOC_TMPL.format(**schema)
+ schema_copy['title_underbar'] = re.sub(r'.', '-', schema['name'])
+ return SCHEMA_DOC_TMPL.format(**schema_copy)
FULL_SCHEMA = None