From 9a397730b4889f246ddf859b012da4c4fa47706b Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Wed, 27 Jan 2021 15:17:32 +0000 Subject: [PATCH] Fix formatting of LXC container config files Spacing changes were inadvertently introduced in https://review.opendev.org/742121 which result in duplicate entries in LXC config files. This commit reverts to the original formatting with spaces either side of the '=', although it makes no attempt to fix files which may already include duplicate entries. Change-Id: Ia95bbc959b54f494b5861afcb4e84d4c227e7b31 --- tasks/lxc_container_config.yml | 2 +- tests/test-containers-functional.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/lxc_container_config.yml b/tasks/lxc_container_config.yml index 583a2b8..3f2a661 100644 --- a/tasks/lxc_container_config.yml +++ b/tasks/lxc_container_config.yml @@ -17,7 +17,7 @@ - name: Write default container config lineinfile: dest: "/var/lib/lxc/{{ inventory_hostname }}/config" - line: "{{ item }}" + line: "{{ item.split('=', 1)[0] }} = {{ item.split('=', 1)[1] }}" backup: "true" with_items: "{{ lxc_container_default_config_list | union(lxc_container_config_list) }}" delegate_to: "{{ physical_host }}" diff --git a/tests/test-containers-functional.yml b/tests/test-containers-functional.yml index ed7e1e1..a85c86b 100644 --- a/tests/test-containers-functional.yml +++ b/tests/test-containers-functional.yml @@ -37,7 +37,7 @@ - lxc_container_list.stdout is search("container3\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},\s+)*10.100.100.4(,\s+\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})*\s+") - name: Check for the presence of the right app armor profile for container1 - command: "grep \"^lxc.apparmor.profile={{ (hostvars[physical_host | default('localhost')]['ansible_distribution'] == 'Debian') | ternary('unconfined', 'lxc-openstack') }}$\" {{ item }}" + command: "grep \"^lxc.apparmor.profile = {{ (hostvars[physical_host | default('localhost')]['ansible_distribution'] == 'Debian') | ternary('unconfined', 'lxc-openstack') }}$\" {{ item }}" register: container_profile failed_when: container_profile.rc != 0 with_sequence: start=1 end=3 format=/var/lib/lxc/container%x/config