Skip to content
538 changes: 341 additions & 197 deletions cloudinit/config/cc_apt_configure.py

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions cloudinit/config/cc_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
'uniqueItems': True,
'description': dedent("""\
List of ntp pools. If both pools and servers are
empty, 4 default pool servers will be provided of
the format ``{0-3}.{distro}.pool.ntp.org``.""")
empty, 4 default pool servers will be provided of
the format ``{0-3}.{distro}.pool.ntp.org``.""")
},
'servers': {
'type': 'array',
Expand All @@ -181,46 +181,46 @@
'uniqueItems': True,
'description': dedent("""\
List of ntp servers. If both pools and servers are
empty, 4 default pool servers will be provided with
the format ``{0-3}.{distro}.pool.ntp.org``.""")
empty, 4 default pool servers will be provided with
the format ``{0-3}.{distro}.pool.ntp.org``.""")
},
'ntp_client': {
'type': 'string',
'default': 'auto',
'description': dedent("""\
Name of an NTP client to use to configure system NTP.
When unprovided or 'auto' the default client preferred
by the distribution will be used. The following
built-in client names can be used to override existing
configuration defaults: chrony, ntp, ntpdate,
systemd-timesyncd."""),
When unprovided or 'auto' the default client preferred
by the distribution will be used. The following
built-in client names can be used to override existing
configuration defaults: chrony, ntp, ntpdate,
systemd-timesyncd."""),
},
'enabled': {
'type': 'boolean',
'default': True,
'description': dedent("""\
Attempt to enable ntp clients if set to True. If set
to False, ntp client will not be configured or
installed"""),
to False, ntp client will not be configured or
installed"""),
},
'config': {
'description': dedent("""\
Configuration settings or overrides for the
``ntp_client`` specified."""),
``ntp_client`` specified."""),
'type': ['object'],
'properties': {
'confpath': {
'type': 'string',
'description': dedent("""\
The path to where the ``ntp_client``
configuration is written."""),
configuration is written."""),
},
'check_exe': {
'type': 'string',
'description': dedent("""\
The executable name for the ``ntp_client``.
For example, ntp service ``check_exe`` is
'ntpd' because it runs the ntpd binary."""),
For example, ntp service ``check_exe`` is
'ntpd' because it runs the ntpd binary."""),
},
'packages': {
'type': 'array',
Expand All @@ -230,22 +230,22 @@
'uniqueItems': True,
'description': dedent("""\
List of packages needed to be installed for the
selected ``ntp_client``."""),
selected ``ntp_client``."""),
},
'service_name': {
'type': 'string',
'description': dedent("""\
The systemd or sysvinit service name used to
start and stop the ``ntp_client``
service."""),
start and stop the ``ntp_client``
service."""),
},
'template': {
'type': 'string',
'description': dedent("""\
Inline template allowing users to define their
own ``ntp_client`` configuration template.
The value must start with '## template:jinja'
to enable use of templating support.
own ``ntp_client`` configuration template.
The value must start with '## template:jinja'
to enable use of templating support.
"""),
},
},
Expand Down
22 changes: 11 additions & 11 deletions cloudinit/config/cc_write_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,34 +103,34 @@
'type': 'string',
'description': dedent("""\
Path of the file to which ``content`` is decoded
and written
and written
"""),
},
'content': {
'type': 'string',
'default': '',
'description': dedent("""\
Optional content to write to the provided ``path``.
When content is present and encoding is not '%s',
decode the content prior to writing. Default:
**''**
When content is present and encoding is not '%s',
decode the content prior to writing. Default:
**''**
""" % UNKNOWN_ENC),
},
'owner': {
'type': 'string',
'default': DEFAULT_OWNER,
'description': dedent("""\
Optional owner:group to chown on the file. Default:
**{owner}**
**{owner}**
""".format(owner=DEFAULT_OWNER)),
},
'permissions': {
'type': 'string',
'default': oct(DEFAULT_PERMS).replace('o', ''),
'description': dedent("""\
Optional file permissions to set on ``path``
represented as an octal string '0###'. Default:
**'{perms}'**
represented as an octal string '0###'. Default:
**'{perms}'**
""".format(perms=oct(DEFAULT_PERMS).replace('o', ''))),
},
'encoding': {
Expand All @@ -139,16 +139,16 @@
'enum': supported_encoding_types,
'description': dedent("""\
Optional encoding type of the content. Default is
**text/plain** and no content decoding is
performed. Supported encoding types are:
%s.""" % ", ".join(supported_encoding_types)),
**text/plain** and no content decoding is
performed. Supported encoding types are:
%s.""" % ", ".join(supported_encoding_types)),
},
'append': {
'type': 'boolean',
'default': False,
'description': dedent("""\
Whether to append ``content`` to existing file if
``path`` exists. Default: **false**.
``path`` exists. Default: **false**.
"""),
},
},
Expand Down
24 changes: 23 additions & 1 deletion cloudinit/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,28 @@ def _get_property_type(property_dict):
return property_type


def _parse_description(description, prefix):
"""Parse description from the schema in a format that we can better
display in our docs. This parser does three things:

- Guarantee that a paragraph will be in a single line
- Guarantee that each new paragraph will be aligned with
the first paragraph
- Proper align lists of items

@param description: The original description in the schema.
@param prefix: The number of spaces used to align the current description
"""
list_paragraph = prefix * 3
description = re.sub(r"(\S)\n(\S)", r"\1 \2", description)
description = re.sub(
r"\n\n", r"\n\n{}".format(prefix), description)
description = re.sub(
r"\n( +)-", r"\n{}-".format(list_paragraph), description)

return description


def _get_property_doc(schema, prefix=' '):
"""Return restructured text describing the supported schema properties."""
new_prefix = prefix + ' '
Expand All @@ -318,7 +340,7 @@ def _get_property_doc(schema, prefix=' '):
prefix=prefix,
prop_name=prop_key,
type=_get_property_type(prop_config),
description=description.replace('\n', '')))
description=_parse_description(description, prefix)))
items = prop_config.get('items')
if items:
if isinstance(items, list):
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/cloud-config-apt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ apt:
# as above, allowing to have one config for different per arch mirrors
# security is optional, if not defined it is set to the same value as primary
security:
uri: http://security.ubuntu.com/ubuntu
- uri: http://security.ubuntu.com/ubuntu
# If search_dns is set for security the searched pattern is:
# <distro>-security-mirror

Expand Down
63 changes: 32 additions & 31 deletions doc/examples/cloud-config-chef-oneiric.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,39 @@
# Key from http://apt.opscode.com/packages@opscode.com.gpg.key
apt:
sources:
- source: "deb http://apt.opscode.com/ $RELEASE-0.10 main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)
source1:
source: "deb http://apt.opscode.com/ $RELEASE-0.10 main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBE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examples/cloud-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,14 @@ ssh_import_id: [smoser]
#
# Default: none
#
debconf_selections: | # Need to preserve newlines
debconf_selections:
# Force debconf priority to critical.
debconf debconf/priority select critical
set1: debconf debconf/priority select critical

# Override default frontend to readline, but allow user to select.
debconf debconf/frontend select readline
debconf debconf/frontend seen false
set2: |
debconf debconf/frontend select readline
debconf debconf/frontend seen false

# manage byobu defaults
# byobu_by_default:
Expand Down
73 changes: 37 additions & 36 deletions tests/cloud_tests/testcases/examples/install_run_chef_recipes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,44 @@ cloud_config: |
#cloud-config
# Key from https://packages.chef.io/chef.asc
apt:
source1:
source: "deb http://packages.chef.io/repos/apt/stable $RELEASE main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (Darwin)
Comment: GPGTools - http://gpgtools.org
sources:
source1:
source: "deb http://packages.chef.io/repos/apt/stable $RELEASE main"
key: |
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (Darwin)
Comment: GPGTools - http://gpgtools.org

mQGiBEppC7QRBADfsOkZU6KZK+YmKw4wev5mjKJEkVGlus+NxW8wItX5sGa6kdUu
twAyj7Yr92rF+ICFEP3gGU6+lGo0Nve7KxkN/1W7/m3G4zuk+ccIKmjp8KS3qn99
dxy64vcji9jIllVa+XXOGIp0G8GEaj7mbkixL/bMeGfdMlv8Gf2XPpp9vwCgn/GC
JKacfnw7MpLKUHOYSlb//JsEAJqao3ViNfav83jJKEkD8cf59Y8xKia5OpZqTK5W
ShVnNWS3U5IVQk10ZDH97Qn/YrK387H4CyhLE9mxPXs/ul18ioiaars/q2MEKU2I
XKfV21eMLO9LYd6Ny/Kqj8o5WQK2J6+NAhSwvthZcIEphcFignIuobP+B5wNFQpe
DbKfA/0WvN2OwFeWRcmmd3Hz7nHTpcnSF+4QX6yHRF/5BgxkG6IqBIACQbzPn6H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