From 985daeaf97a0b179da3ce9d268360b4f861109c9 Mon Sep 17 00:00:00 2001 From: Wesley Hayutin Date: Wed, 19 May 2021 11:39:11 -0600 Subject: [PATCH] DNM, debug for container-modify Change-Id: Ie3132176b2cebc4c1f173b2cdd3e736d503bba5e --- tasks/rpm_install.yml | 5 +++-- tasks/yum_update_buildah.yml | 26 ++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tasks/rpm_install.yml b/tasks/rpm_install.yml index 8d71648..2281748 100644 --- a/tasks/rpm_install.yml +++ b/tasks/rpm_install.yml @@ -6,9 +6,10 @@ - import_tasks: get_original_user.yml - name: Create image build context directory - tempfile: + file: state: directory - prefix: tripleo-modify-image + path: /home/zuul/tripleo-modify-image + mode: 0755 register: context_dir - name: Set modify_dir_path diff --git a/tasks/yum_update_buildah.yml b/tasks/yum_update_buildah.yml index bbb9970..4d1f6bc 100644 --- a/tasks/yum_update_buildah.yml +++ b/tasks/yum_update_buildah.yml @@ -106,7 +106,7 @@ - name: Run yum_update.sh command: > buildah run - --volume {{ yum_update.path }}:/tmp/yum_update.sh + --volume {{ yum_update.path }}:/tmp --volume {{ yum_repos_dir_path }}:/etc/yum.repos.d {% if pkg_mgr_vars_stat.stat.exists %} --volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars @@ -123,14 +123,14 @@ --user root --net host {{ from_image }} - /tmp/yum_update.sh "{{ update_repo }}" + /tmp/yum_update.sh "{{ update_repo }}" &> /tmp/yum_update.log register: result rescue: - name: Run yum_update.sh (retry without yum cache) command: > buildah --debug run - --volume {{ yum_update.path }}:/tmp/yum_update.sh + --volume {{ yum_update.path }}:/tmp --volume {{ yum_repos_dir_path }}:/etc/yum.repos.d {% if pkg_mgr_vars_stat.stat.exists %} --volume /etc/{{ pkg_mgr_suffix }}/vars:/etc/{{ pkg_mgr_suffix }}/vars @@ -144,12 +144,30 @@ --user root --net host {{ from_image }} - bash -x /tmp/yum_update.sh "{{ update_repo }}" + bash -x /tmp/yum_update.sh "{{ update_repo }}" &> /tmp/yum_update.log retries: 2 delay: 3 register: result until: result.rc == 0 +- name: deliniate log with container name + become: true + command: > + /usr/bin/touch /var/log/container_yum_update.log + '/usr/bin/echo "** {{ source_image }} **" >> /var/log/container_yum_update.log' + /usr/bin/cat /tmp/yum_update.log >> /var/log/container_yum_update.log + +#- name: log container yum transaction +# command: > +# buildah --debug run +# --user root +# --net host +# {{ from_image }} +# /usr/bin/cat /tmp/yum_update.log &>> /var/log/container_yum_update.log +# retries: 2 +# delay: 3 +# ignore_errors: true + - name: Remove temporary yum_update.sh script file: path: "{{ yum_update.path }}"