Skip to content

Commit

Permalink
testing: stop universally overwriting /etc/cloud/cloud.cfg.d (#1237)
Browse files Browse the repository at this point in the history
As part of IN_PLACE testing, /etc/cloud/cloud.cfg.d get overwritten by
what's in the source tree. This can cause problems when the directory is
mounted in, because tests need the ability to modify files in
/etc/cloud. Attempting to 'lxc file push'  instead will fail on LXD VMs
because the LXD agent isn't available yet.

If such functionality is desired, one can temporarily use the
'lxd_setup' mark while writing a test and push the files manually.
  • Loading branch information
TheRealFalcon authored Feb 3, 2022
1 parent 3f0918b commit aa47ec0
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions tests/integration_tests/clouds.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,6 @@ def _mount_source(instance: LXDInstance):
).format(**format_variables)
subp(command.split())

# /etc/cloud/cloud.cfg.d is a directory we write to in some
# integration tests. We can't use lxc mount in the container
# as /etc/cloud/cloud.cfg.d will then be owned nobody:nogroup and be
# read-only for root.
# Instead copy static files to the instance under test.
config_dir = os.path.join(
cloudinit_path, "..", "config", "cloud.cfg.d"
)
for src_file in os.listdir(config_dir):
command = (
f"lxc file push {config_dir}/{src_file} "
f"{instance.name}/etc/cloud/cloud.cfg.d/"
)
subp(command.split())

def _perform_launch(self, launch_kwargs, **kwargs):
launch_kwargs["inst_type"] = launch_kwargs.pop("instance_type", None)
wait = launch_kwargs.pop("wait", True)
Expand Down

0 comments on commit aa47ec0

Please sign in to comment.