canonical / canonical/cloud-init

[docs]: Understanding how merge rules work

Open
#5,866 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

# Documentation request

https://cloudinit.readthedocs.io/en/latest/reference/merging.html#specifying-multiple-types-and-what-this-does

Hello,

I'm trying to understand how merging rules behave, since I'm getting a different behavior than my interpretation of the documentation.

I have a simple case, where, I'm using a `#cloud-config-archive` with two `#cloud-config` parts. Let's call them CC1 (cloud-config 1) and CC2 (cloud-config 2).

```
#cloud-config-archive
- type: 'text/cloud-config'
content: |
#cloud-config
merge_how:
- name: list
settings: ['append']
- name: list
settings: ['no_replace', 'recurse_list']
runcmd:
- echo "Hello, World!" > /tmp/hello.txt

- type: 'text/cloud-config'
content: |
#cloud-config
runcmd:
- echo "Hello, World! 2" > /tmp/hello2.txt
```

Based on the documentation, my interpretation is that, after CC1 is processed, `merge_how` rules will apply to CC2 gets merged into CC1. That doesn't seem to be happening. Now, if I move the `merge_how` rules to CC2, I get the expected behavior where runcmd has both commands.

I just want to understand if I'm misunderstanding the documentation and there might be an opportunity for improvement.

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.