summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandan Kumar <chkumar@redhat.com>2019-02-12 08:05:22 +0000
committerChandan Kumar <chkumar@redhat.com>2019-02-18 18:22:40 +0530
commit410408ef1b665aab4672d4b3dad2bbc7de543b7d (patch)
tree9612df2fcee0691014beecee3b536987167507ef
parentb541c5ef99d61d56e78eeb00a0ae7faacc4dd604 (diff)
Ported tripleo-modify-image to py3
It makes yum and pip installs work with py3 packages. The package manager dnf/yum and pip binary are determined at run time from the OS. Use dnf-plugins-core for dnf with respect to yum-plugin-priorities. Use pipefail with set -ex to fix linter errors. Change-Id: I997509204e30abb8b21ef936ea44440fbaa5a0e4 Closes-Bug: #1813546
Notes
Notes (review): Code-Review+2: Bogdan Dobrelya <bdobreli@redhat.com> Code-Review+1: Sorin Sbarnea <ssbarnea@redhat.com> Code-Review+2: Quique Llorente <ellorent@redhat.com> Code-Review+2: Emilien Macchi <emilien@redhat.com> Workflow+1: Emilien Macchi <emilien@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 18 Feb 2019 21:10:51 +0000 Reviewed-on: https://review.openstack.org/634904 Project: openstack/ansible-role-tripleo-modify-image Branch: refs/heads/master
-rw-r--r--files/dev_install.sh2
-rwxr-xr-xfiles/rpm_install.sh2
-rwxr-xr-xfiles/yum_update.sh15
-rw-r--r--templates/Dockerfile-dev.j28
4 files changed, 20 insertions, 7 deletions
diff --git a/files/dev_install.sh b/files/dev_install.sh
index d6ce5f7..0b2f540 100644
--- a/files/dev_install.sh
+++ b/files/dev_install.sh
@@ -1,4 +1,4 @@
1set -e 1set -eou pipefail
2 2
3# Cherry-pick a refspec 3# Cherry-pick a refspec
4# $1 : project name e.g. keystone 4# $1 : project name e.g. keystone
diff --git a/files/rpm_install.sh b/files/rpm_install.sh
index f63fab1..003f85d 100755
--- a/files/rpm_install.sh
+++ b/files/rpm_install.sh
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2 2
3set -ex 3set -eox pipefail
4 4
5rpm -Uvh /tmp/*.rpm 5rpm -Uvh /tmp/*.rpm
6rm -f /tmp/*.rpm 6rm -f /tmp/*.rpm
diff --git a/files/yum_update.sh b/files/yum_update.sh
index f5918ee..62c15fd 100755
--- a/files/yum_update.sh
+++ b/files/yum_update.sh
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2 2
3set -eux 3set -eoux pipefail
4 4
5packages_for_update= 5packages_for_update=
6if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then 6if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then
@@ -14,6 +14,13 @@ if [ -z "$packages_for_update" ]; then
14 exit 14 exit
15fi 15fi
16 16
17yum install -y yum-plugin-priorities 17PKG="$(command -v dnf || command -v yum)"
18yum -y update $packages_for_update 18PKG_MGR="$(echo ${PKG:(-3)})"
19rm -rf /var/cache/yum 19
20if [ $PKG_MGR == "dnf" ]; then
21 $PKG install -y dnf-plugins-core
22else:
23 $PKG install -y yum-plugin-priorities
24fi
25$PKG -y update $packages_for_update
26rm -rf /var/cache/$PKG_MGR
diff --git a/templates/Dockerfile-dev.j2 b/templates/Dockerfile-dev.j2
index 8e4d100..b71bada 100644
--- a/templates/Dockerfile-dev.j2
+++ b/templates/Dockerfile-dev.j2
@@ -4,6 +4,12 @@ LABEL modified_append_tag={{ modified_append_tag }}
4USER root 4USER root
5 5
6COPY refspec_projects /root/refspec_projects 6COPY refspec_projects /root/refspec_projects
7RUN /bin/bash -c 'rpm -qi python-pip || yum install -y python-pip; cd /; for X in $(ls /root/refspec_projects/*.tar.gz); do pip install $X; done; rm -Rf /root/refspec_projects' 7RUN /bin/bash -c 'PKG="$(command -v dnf || command -v yum)"; \
8 PKG_MGR="$(echo ${PKG:(-3)})"; \
9 if [ $PKG_MGR == "dnf" ]; then $PKG install python3-pip; PIP=pip3; else $PKG install python-pip; \
10 PIP=pip; fi; \
11 cd /; \
12 for X in $(ls /root/refspec_projects/*.tar.gz); do $PIP install $X; done; \
13 rm -Rf /root/refspec_projects'
8 14
9USER "{{ original_user }}" 15USER "{{ original_user }}"