canonical / canonical/cloud-init
cloud-init-single-module-fails-to-merge
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 22
Description
This bug was originally filed in Launchpad as [LP: #1316323](https://bugs.launchpad.net/cloud-init/+bug/1316323)
Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = None
date_created = 2014-05-05T21:36:11.303265+00:00
date_fix_committed = None
date_fix_released = None
id = 1316323
importance = low
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1316323
milestone = None
owner = mmorais
owner_name = Marco Morais
private = False
status = confirmed
submitter = mmorais
submitter_name = Marco Morais
tags = []
duplicates = []
_Launchpad user **Marco Morais(mmorais)** wrote on 2014-05-05T21:36:11.303265+00:00_
I have a yaml file in a local directory (cloud-init.yaml) which contains 2 modules (write_files, runcmd). I am exercising the write_files module using the following command:
$ sudo cloud-init --debug --file cloud-init.yaml single --name cc_write_files
From the debug output I can see that the local file (/home/mmorais/cloud-init.yaml) is not getting merged into the master config file (/var/lib/cloud/instance/cloud-config.txt).
2014-05-05 21:25:45,367 - __init__.py[DEBUG]: Merging using located merger 'DictMerger: (method=no_replace,recurse_str=False,recurse_dict=True,recurse_array=False,allow_delete=False)' since it had method '_on_dict'
2014-05-05 21:25:45,368 - util.py[DEBUG]: Reading from /home/mmorais/cloud-init.yaml (quiet=False)
2014-05-05 21:25:45,368 - util.py[DEBUG]: Read 407 bytes from /home/mmorais/cloud-init.yaml
2014-05-05 21:25:45,368 - util.py[DEBUG]: < #cloud-config
2014-05-05 21:25:45,368 - util.py[DEBUG]: < write_files:
2014-05-05 21:25:45,368 - util.py[DEBUG]: < - content: |
2014-05-05 21:25:45,368 - util.py[DEBUG]: < #!/bin/sh
2014-05-05 21:25:45,368 - util.py[DEBUG]: < date +"%s" > /home/y/tmp/now.txt
2014-05-05 21:25:45,368 - util.py[DEBUG]: < path: /home/y/tmp/upload-boot-time.sh
2014-05-05 21:25:45,368 - util.py[DEBUG]: < permissions: '0755'
2014-05-05 21:25:45,369 - util.py[DEBUG]: < runcmd:
2014-05-05 21:25:45,369 - util.py[DEBUG]: < - ['/home/y/tmp/upload-boot-time.sh']
2014-05-05 21:25:45,369 - util.py[DEBUG]: Attempting to load yaml from string of length 407 with allowed root types (,)
2014-05-05 21:25:45,371 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/cloud-config.txt (quiet=False)
2014-05-05 21:25:45,371 - util.py[DEBUG]: Read 0 bytes from /var/lib/cloud/instance/cloud-config.txt
2014-05-05 21:25:45,371 - util.py[DEBUG]: Attempting to load yaml from string of length 0 with allowed root types (,)
2014-05-05 21:25:45,371 - util.py[DEBUG]: load_yaml given empty string, returning default
As a workaround I am copying /home/mmorais/cloud-init.yaml to /var/lib/cloud/instance/cloud-config.txt which defeats the purpose of being able to run cloud-init on arbitrary files for testing.
Also note that the command above does not work at all unless I specify *cc_write_files* instead of *write_files*.
I am running cloud-init (0.7.4).
Contributor guide
Research direction
Start by reproducing the reported command, `cloud-init --debug --file cloud-init.yaml single --name cc_write_files`, with the two-module YAML shown in the issue. Trace the `single` entry point and the merge behavior logged from `__init__.py` and `util.py`, including the `cc_write_files` versus `write_files` naming. Done means arbitrary local configuration is merged for single-module testing and the documented module name works consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100