From bc21900d06af4de7cb78cfeda2088fa08bbc7c17 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Tue, 26 May 2020 12:24:08 -0500 Subject: [PATCH] Fix become and remote_src when modifying an image This change updates the copy task to assume the source is remote. This will allow the module to use any path provided and not assume the file is within the relative path from the role. The become jinja used in the task "Modify image from {{ modify_dir_path }}" was attempting to match on the full command executed, which would always evaluate to `false`. This change corrects the condition so that it can evaluate to true, when "buildah" is used. Change-Id: I348dbf91b5f2e0dcdfeffd336782c24499d7a569 Signed-off-by: Kevin Carter --- tasks/modify_image.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/modify_image.yml b/tasks/modify_image.yml index ff5d569..234cec9 100644 --- a/tasks/modify_image.yml +++ b/tasks/modify_image.yml @@ -19,6 +19,7 @@ copy: src: "{{ modify_dir_path }}/Dockerfile" dest: "{{ dockerfile.path }}" + remote_src: true - name: Replace FROM directive lineinfile: @@ -38,6 +39,6 @@ --tag {{ target_image | default(source_image) }}{{ modified_append_tag }} \ --file {{ dockerfile.path }} --network host ./ # FIXME: buildah should not required root commands to build an image - become: "{{ true if build_commands[container_build_tool] == 'buildah' else false }}" + become: "{{ container_build_tool == 'buildah' }}" args: chdir: "{{ modify_dir_path }}"