cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05899
[Merge] ~smoser/cloud-init:doc/add-new-datasource-doc into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:doc/add-new-datasource-doc into cloud-init:master.
Commit message:
Add documentation on adding a datasource.
This adds documentation intended for a developer on how to add
a new datasource to cloud-init.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/361466
see commit message
--
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:doc/add-new-datasource-doc into cloud-init:master.
diff --git a/doc/rtd/topics/datasources.rst b/doc/rtd/topics/datasources.rst
index e34f145..7fa82f1 100644
--- a/doc/rtd/topics/datasources.rst
+++ b/doc/rtd/topics/datasources.rst
@@ -18,7 +18,7 @@ single way to access the different cloud systems methods to provide this data
through the typical usage of subclasses.
Any metadata processed by cloud-init's datasources is persisted as
-``/run/cloud0-init/instance-data.json``. Cloud-init provides tooling
+``/run/cloud-init/instance-data.json``. Cloud-init provides tooling
to quickly introspect some of that data. See :ref:`instance_metadata` for
more information.
@@ -80,6 +80,46 @@ The current interface that a datasource object must provide is the following:
def get_package_mirror_info(self)
+Adding a new Datasource
+-----------------------
+The datasource objects have a few touch points with cloud-init. If you
+are interested in adding a new datasource for your cloud platform you'll
+need to take care of the following items:
+
+* **Add datasource module ``cloudinit/sources/DataSource<CloudPlatform>.py``**:
+ It is suggested that you start by copying one of the simpler datasources
+ such as DataSourceHetzner.
+
+* **Add tests for datasource module**:
+ Add a new file with some tests for the module to
+ ``cloudinit/sources/test_<yourplatform>.py``. For example see
+ ``cloudinit/sources/tests/test_oracle.py``
+
+* **Update ds-identify**: In systemd systems, ds-identify is used to detect
+ which datasources should be enabled or if cloud-init should run at all.
+
+* **Add tests for ds-identify**: Add relevant tests in a new class to
+ ``tests/unittests/test_ds_identify.py``. You can use ``TestOracle`` as an
+ example.
+
+* **Add your datasource name to the builtin list of datasources:** Add
+ your datasource module name to the end of the ``datasource_list``
+ entry in ``cloudinit/settings.py``.
+
+* **Add your your cloud platform to apport collection prompts:** Update the
+ list of cloud platforms in ``cloudinit/apport.py``. This list will be
+ provided to the user who invokes ``ubuntu-bug cloud-init``.
+
+* **Enable datasource by default in ubuntu packaging branches:**
+ Ubuntu packaging branches contain a template file
+ ``debian/cloud-init.templates`` that ultimately sets the default
+ datasource_list when installed via package. This file needs updating when
+ the commit gets into a package.
+
+* **Add documentation for your datasource**: You should add a new
+ file in ``doc/datasources/<cloudplatform>.rst``
+
+
Datasource Documentation
========================
The following is a list of the implemented datasources.
Follow ups