Browse Source

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>
changes/25/730925/1
Kevin Carter 1 month ago
parent
commit
bc21900d06
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      tasks/modify_image.yml

+ 2
- 1
tasks/modify_image.yml 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 }}"

Loading…
Cancel
Save