From: Loic Dachary Date: Sat, 3 Oct 2015 12:42:44 +0000 (+0200) Subject: tests: allow docker-test.sh to run under root X-Git-Tag: v10.0.0~111^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6173%2Fhead;p=ceph.git tests: allow docker-test.sh to run under root Do not attempt to create a user if it is root because it already exists. http://tracker.ceph.com/issues/13355 Fixes: #13355 Signed-off-by: Loic Dachary --- diff --git a/src/test/centos-6/Dockerfile.in b/src/test/centos-6/Dockerfile.in index a2eece88b1a7..6caf951b50a8 100644 --- a/src/test/centos-6/Dockerfile.in +++ b/src/test/centos-6/Dockerfile.in @@ -27,4 +27,4 @@ RUN yum install -y which ; cd /root ; ./install-deps.sh # development tools # nc is required to run make check on firefly only (giant+ do not use nc) RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq sudo xmlstarlet parted nc -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/centos-7/Dockerfile.in b/src/test/centos-7/Dockerfile.in index 19fe1aa099f0..42810f6795f4 100644 --- a/src/test/centos-7/Dockerfile.in +++ b/src/test/centos-7/Dockerfile.in @@ -30,4 +30,4 @@ RUN cd /root ; ./install-deps.sh # development tools # nc is required to run make check on firefly only (giant+ do not use nc) RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq sudo xmlstarlet parted nc -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/debian-jessie/Dockerfile.in b/src/test/debian-jessie/Dockerfile.in index c9287bd6210d..59f9072fdd5d 100644 --- a/src/test/debian-jessie/Dockerfile.in +++ b/src/test/debian-jessie/Dockerfile.in @@ -28,4 +28,4 @@ RUN apt-get update RUN cd /root ; ./install-deps.sh # development tools RUN apt-get install -y ccache valgrind gdb python-virtualenv gdisk kpartx hdparm jq xmlstarlet -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/fedora-21/Dockerfile.in b/src/test/fedora-21/Dockerfile.in index 9b606ea46f2c..7e01fab65aba 100644 --- a/src/test/fedora-21/Dockerfile.in +++ b/src/test/fedora-21/Dockerfile.in @@ -26,4 +26,4 @@ RUN yum install -y which ; cd /root ; ./install-deps.sh # development tools # nc is required to run make check on firefly only (giant+ do not use nc) RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq sudo xmlstarlet parted nc -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/opensuse-13.2/Dockerfile.in b/src/test/opensuse-13.2/Dockerfile.in index 85d91a2f6072..20eb1814f519 100644 --- a/src/test/opensuse-13.2/Dockerfile.in +++ b/src/test/opensuse-13.2/Dockerfile.in @@ -27,4 +27,4 @@ RUN cd /root ; ./install-deps.sh # development tools # nc (ncat) is required to run make check on firefly only (giant+ do not use nc) RUN zypper --non-interactive install ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm ncat sudo xmlstarlet parted -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/ubuntu-12.04/Dockerfile.in b/src/test/ubuntu-12.04/Dockerfile.in index ed55bad234ef..5a1c6a16fe65 100644 --- a/src/test/ubuntu-12.04/Dockerfile.in +++ b/src/test/ubuntu-12.04/Dockerfile.in @@ -28,4 +28,4 @@ RUN apt-get update RUN cd /root ; ./install-deps.sh # development tools RUN apt-get install -y sudo ccache valgrind gdb python-virtualenv gdisk kpartx hdparm xmlstarlet -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi diff --git a/src/test/ubuntu-14.04/Dockerfile.in b/src/test/ubuntu-14.04/Dockerfile.in index fddf929324dc..51b47ad4ae49 100644 --- a/src/test/ubuntu-14.04/Dockerfile.in +++ b/src/test/ubuntu-14.04/Dockerfile.in @@ -28,4 +28,4 @@ RUN apt-get update RUN cd /root ; ./install-deps.sh # development tools RUN apt-get install -y ccache valgrind gdb python-virtualenv gdisk kpartx hdparm jq xmlstarlet -RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers +RUN if test %%USER%% != root ; then useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers ; fi