-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema: add json defs for modules U-Z #1360
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments inline. Additionally, see the following diff:
diff --git a/cloudinit/config/cc_zypper_add_repo.py b/cloudinit/config/cc_zypper_add_repo.py
index 330ef346..9b682bc6 100644
--- a/cloudinit/config/cc_zypper_add_repo.py
+++ b/cloudinit/config/cc_zypper_add_repo.py
@@ -3,7 +3,7 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
-"""zypper_add_repo: Add zyper repositories to the system"""
+"""zypper_add_repo: Add zypper repositories to the system"""
import os
from textwrap import dedent
@@ -16,22 +16,25 @@ from cloudinit.config.schema import MetaSchema, get_meta_doc
from cloudinit.settings import PER_ALWAYS
distros = ["opensuse", "sles"]
-
+MODULE_DESCRIPTION = """\
+Zypper behavior can be configured using the ``config`` key, which will modify
+``/etc/zypp/zypp.conf``. The configuration writer will only append the
+provided configuration options to the configuration file. Any duplicate
+options will be resolved by the way the zypp.conf INI file is parsed.
+
+.. note::
+ Setting ``configdir`` is not supported and will be skipped.
+
+The ``repos`` key may be used to add repositories to the system. Beyond the
+required ``id`` and ``baseurl`` attributions, no validation is performed
+on the ``repos`` entries. It is assumed the user is familiar with the
+zypper repository file format.
+"""
meta: MetaSchema = {
"id": "cc_zypper_add_repo",
- "name": "ZypperAddRepo",
+ "name": "Zypper Add Repo",
"title": "Configure zypper behavior and add zypper repositories",
- "description": dedent(
- """\
- Configure zypper behavior by modifying /etc/zypp/zypp.conf. The
- configuration writer is "dumb" and will simply append the provided
- configuration options to the configuration file. Option settings
- that may be duplicate will be resolved by the way the zypp.conf file
- is parsed. The file is in INI format.
- Add repositories to the system. No validation is performed on the
- repository file entries, it is assumed the user is familiar with
- the zypper repository file format."""
- ),
+ "description": MODULE_DESCRIPTION,
"distros": distros,
"examples": [
dedent(
diff --git a/doc/rtd/topics/modules.rst b/doc/rtd/topics/modules.rst
index 093cee61..9541f675 100644
--- a/doc/rtd/topics/modules.rst
+++ b/doc/rtd/topics/modules.rst
@@ -64,4 +64,5 @@ Modules
.. automodule:: cloudinit.config.cc_users_groups
.. automodule:: cloudinit.config.cc_write_files
.. automodule:: cloudinit.config.cc_yum_add_repo
+.. automodule:: cloudinit.config.cc_zypper_add_repo
.. vi: textwidth=79
Changes:
- Zypper module had a typo in its docstring
- I decided to rewrite the zypper module description. It doesn't make much sense and doesn't follow inclusive naming standards.
- Added the zypper module to the end of modules.rst so it gets included in the documentation.
"properties": { | ||
"manage_etc_hosts": { | ||
"default": false, | ||
"description": "Whether to manage /etc/hosts on the system. When set ``true``, cloud-init will render the hosts file using ``/etc/cloud/templates/hosts.tmpl`` replacing ``$hostname`` and ``$fdqn``. When set ``localhost``, Default: ``false``. DEPRECATED value ``template``will be dropped, use ``true`` instead.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When set localhost, Default: false
^ I think you accidentally your sentence there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 I also changed the oneOf to "enum": [true, false, "template", "localhost"] which I think provides a better schema error message
'templatey' is not one of [True, False, 'template', 'localhost']`
versus
'templatey' is not valid under any of the given schemas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small language thing inline, but I trust you can fix that and merge when finished.
@@ -1517,8 +1517,8 @@ | |||
"properties": { | |||
"manage_etc_hosts": { | |||
"default": false, | |||
"description": "Whether to manage /etc/hosts on the system. When set ``true``, cloud-init will render the hosts file using ``/etc/cloud/templates/hosts.tmpl`` replacing ``$hostname`` and ``$fdqn``. When set ``localhost``, Default: ``false``. DEPRECATED value ``template``will be dropped, use ``true`` instead.", | |||
"oneOf": [{"type": "boolean"}, {"enum": ["template", "localhost"]}] | |||
"description": "Whether to manage ``/etc/hosts`` on the system. Set ``true`` to render the hosts file using ``/etc/cloud/templates/hosts.tmpl`` replacing ``$hostname`` and ``$fdqn``. Set ``localhost`` to and cloud-init will append a ``127.0.1.1`` entry that resolves from FQDN and hostname every boot. Default: ``false``. DEPRECATED value ``template`` will be dropped, use ``true`` instead.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more nit here: Set localhost to and cloud-init will append
. Set localhost to what?
Add minItems: "1" to write_files schema to avoid empty list.
While schema still supports manage_etc_hosts: template, deprecate this value as it is an alias for true. Add DEPRECATED log for use of 'template' value.
frequency: ALWAYS was listed in the docstring, but it wasn't provided as a module-level freq attribute. So cloud-init actually defaults it to PER_INSTANCE. We don't want to change behavior, so let's set PER_INSTANCE here which also aligns with apt_configure module for setting up repos.
- cc_update_etc_hosts: drop "template" documentation - cc_update_hostname: missing dedents - cc_write_files: move distros= ["all"] into Meta drop schema comment - cc_yum: example for yum_repo_dir - cloud-init-schema.json: - manage_etc_hosts: descr ++ flat enum vs oneOf [boolean, enum] - yum: descr updates, patternPropery labels
Proposed Commit Message
Additional Context
Does not contain cc_user_groups as that's a fairly big module schema to sort, so I'd like to keep that module separate for
ease of review.
Test Steps
Checklist: