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 <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-05-26 12:24:08 -05:00
parent bb6f78deca
commit bc21900d06
1 changed files with 2 additions and 1 deletions

View File

@ -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 }}"