I'll look at the tool/ccfg-merge-debug; but it didn't look immediately helpful, 
so I ended up launching an lxd container with two files in 
/etc/cloud/cloud.cfg.d/ and using cloud-init clean --logs --reboot instead.

I'll take a second look at the tool.


Diff comments:

> diff --git a/doc/rtd/topics/merging.rst b/doc/rtd/topics/merging.rst
> index c75ca59..3761305 100644
> --- a/doc/rtd/topics/merging.rst
> +++ b/doc/rtd/topics/merging.rst
> @@ -201,4 +201,43 @@ Note, however, that merge algorithms are not used 
> *across* types of
>  configuration.  As was the case before merging was implemented,
>  user-data will overwrite conf.d configuration without merging.
>  
> +Example cloud-config
> +====================
> +
> +A common request is to include multiple ``runcmd`` directives in different
> +files and merge all of the commands together.  To achieve this, we must 
> modify
> +the default merging to allow for dictionaries to join list values.
> +
> +
> +The first config
> +
> +.. code-block:: yaml
> +
> +   #cloud-config
> +   merge_how:
> +    - name: list
> +      settings: [append]
> +    - name: dict
> +      settings: [no_replace, recurse_list]

Yes and no.  I can clarify though.  If you are the *first* config to include 
the key you're interested in, and you're sure that no other config file will 
get read before you (in which case you'll clobber it) then no.

I found this troublesome and really wanted a *global* way to configure merging 
for *all* configs, but that's not available at this time.  This is the only way 
to ensure that conflicting keys retain data (the default is to overwrite 
dictionaries and lists).

> +
> +   runcmd:
> +     - bash1
> +     - bash2
> +
> +The second config
> +
> +.. code-block:: yaml
> +
> +   #cloud-config
> +   merge_how:
> +    - name: list
> +      settings: [append]
> +    - name: dict
> +      settings: [no_replace, recurse_list]
> +
> +   runcmd:
> +     - bash3
> +     - bash4
> +
> +
>  .. vi: textwidth=78


-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/362083
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/merge-how-docs into cloud-init:master.

_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to