← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~smoser/cloud-init:doc/add-new-datasource-doc into cloud-init:master

 


Diff comments:

> 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
> @@ -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.

Do we have references in ds-identify or else where that indicate our preference;
like implementing DMI_PRODUCT_NAME to identify the datasource/host?

If not, does it make sense to list those thoughts here?

> +
> +* **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.


-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/361466
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.


References