Skip to content

Commit

Permalink
Merge pull request #677 from splunk/python-ansible-upgrade
Browse files Browse the repository at this point in the history
redhat8 py/ansible upgrade
  • Loading branch information
jmeixensperger authored Jun 18, 2024
2 parents 120bf34 + 57045ec commit 9b55b69
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 18 deletions.
4 changes: 4 additions & 0 deletions base/centos-7/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ rm -rf /etc/security/limits.d/20-nproc.conf
# Clean
yum clean all
rm -rf /anaconda-post.log /var/log/anaconda/*

# symlink for python3
ln -s /bin/python3 /bin/python
ln -sf /usr/bin/pip3.7 /usr/bin/pip3
1 change: 1 addition & 0 deletions base/centos-8/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ echo "

# symlink for python3
ln -s /bin/python3 /bin/python
ln -sf /usr/bin/pip3.7 /usr/bin/pip3

# Clean
yum clean all
Expand Down
4 changes: 4 additions & 0 deletions base/debian-10/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,7 @@ chmod u+s /bin/ping
# Clean
apt clean autoclean
rm -rf /var/lib/apt/lists/*

# Symlink python/pip
ln -sf /usr/bin/python3.7 /usr/bin/python3
ln -sf /usr/bin/pip3.7 /usr/bin/pip3
4 changes: 4 additions & 0 deletions base/debian-9/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ chmod u+s /bin/ping
# Clean
apt clean autoclean
rm -rf /var/lib/apt/lists/*

# Symlink python/pip
ln -sf /usr/bin/python3.7 /usr/bin/python3
ln -sf /usr/bin/pip3.7 /usr/bin/pip3
4 changes: 2 additions & 2 deletions base/redhat-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ LABEL name="splunk" \
ARG BUSYBOX_URL

ENV BUSYBOX_URL=${BUSYBOX_URL} \
PYTHON_VERSION=3.7.16 \
PYTHON_GPG_KEY_ID=0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
PYTHON_VERSION=3.9.19 \
PYTHON_GPG_KEY_ID=E3FF2839C048B25C084DEBE9B26995E310250568

COPY install.sh /install.sh

Expand Down
7 changes: 5 additions & 2 deletions base/redhat-8/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ set -e

# Generate UTF-8 char map and locale
# Reinstalling local English def for now, removed in minimal image: https://bugzilla.redhat.com/show_bug.cgi?id=1665251
microdnf -y --nodocs install glibc-langpack-en
# Comment below install until glibc update is available in minimal image: https://access.redhat.com/errata/RHSA-2024:2722
#microdnf -y --nodocs install glibc-langpack-en

# Currently there is no access to the UTF-8 char map. The following command is commented out until
# the base container can generate the locale.
Expand Down Expand Up @@ -71,10 +72,12 @@ make altinstall LDFLAGS="-Wl,--strip-all"
rm -rf /tmp/pyinstall
ln -sf /usr/bin/python${PY_SHORT} /usr/bin/python
ln -sf /usr/bin/pip${PY_SHORT} /usr/bin/pip
ln -sf /usr/bin/python${PY_SHORT} /usr/bin/python3
ln -sf /usr/bin/pip${PY_SHORT} /usr/bin/pip3

# Install splunk-ansible dependencies
cd /
/usr/bin/python3.7 -m pip install --upgrade pip
/usr/bin/python3.9 -m pip install --upgrade pip
pip -q --no-cache-dir install --upgrade "requests_unixsocket<2.29" "requests<2.29" six wheel Mako "urllib3<2.0.0" certifi jmespath future avro cryptography lxml protobuf setuptools ansible

# Remove tests packaged in python libs
Expand Down
3 changes: 1 addition & 2 deletions py23-image/centos-7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \
&& python3.7 get-pip.py \
&& rm -f get-pip.py \
#pip version is not automatically "fixed", unlike debian-based
&& ln -sf /usr/bin/pip2 /usr/bin/pip \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3
&& ln -sf /usr/bin/pip2 /usr/bin/pip
RUN yum remove -y --setopt=tsflags=noscripts gcc openssl-devel bzip2-devel libffi-devel \
&& yum autoremove -y \
&& yum clean all
Expand Down
3 changes: 1 addition & 2 deletions py23-image/centos-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ RUN wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz \
&& python3.7 get-pip.py \
&& rm -f get-pip.py \
# pip version is not automatically "fixed", unlike debian-based
&& ln -sf /usr/bin/pip2 /usr/bin/pip \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3
&& ln -sf /usr/bin/pip2 /usr/bin/pip
# add python alias
# && ln -s /bin/python3 /bin/python

Expand Down
2 changes: 0 additions & 2 deletions py23-image/debian-10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ USER root

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libpython-dev python-pip python-requests python-jmespath python-yaml \
&& ln -sf /usr/bin/python3.7 /usr/bin/python3 \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3 \
&& ln -sf /usr/bin/python3.7 /usr/bin/python \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip \
&& pip3 install --upgrade ansible==3.4.0 requests==2.25.1 pyyaml==5.4.1 jmespath==0.10.0
2 changes: 0 additions & 2 deletions py23-image/debian-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ USER root

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libpython-dev python-pip python-requests python-jmespath python-yaml \
&& ln -sf /usr/bin/python3.7 /usr/bin/python3 \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3 \
&& ln -sf /usr/bin/python3.7 /usr/bin/python \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip \
&& pip3 install --upgrade ansible==3.4.0 requests==2.25.1 pyyaml==5.4.1 jmespath==0.10.0
11 changes: 5 additions & 6 deletions py23-image/redhat-8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ FROM ${SPLUNK_PRODUCT}-redhat-8:latest
USER root

RUN microdnf -y --nodocs update \
&& microdnf -y --nodocs install python2-pip python2-devel \
&& microdnf -y --nodocs install python2 \
&& pip2 install --upgrade pip \
&& pip2 --no-cache-dir install requests pyyaml jmespath \
&& ln -sf /usr/bin/python3.7 /usr/bin/python3 \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip3 \
&& ln -sf /usr/bin/python3.7 /usr/bin/python \
&& ln -sf /usr/bin/pip3.7 /usr/bin/pip \
&& pip3 install --upgrade ansible==3.4.0 requests==2.25.1 pyyaml==5.4.1 jmespath==0.10.0
&& ln -sf /usr/bin/python3.9 /usr/bin/python \
&& ln -sf /usr/bin/pip3.9 /usr/bin/pip \
&& pip3 install --upgrade requests==2.25.1 pyyaml==5.4.1 jmespath==0.10.0
1 change: 1 addition & 0 deletions splunk/common-files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans
&& chgrp ${ANSIBLE_GROUP} ${SPLUNK_ANSIBLE_HOME} ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& chmod 775 ${SPLUNK_ANSIBLE_HOME} \
&& chmod 664 ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& sed -i '/^\[defaults\]/a\interpreter_python = /usr/bin/python3' ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh

USER ${ANSIBLE_USER}
Expand Down
1 change: 1 addition & 0 deletions uf/common-files/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ RUN sed -i -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL\nans
&& chgrp ${ANSIBLE_GROUP} ${SPLUNK_ANSIBLE_HOME} ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& chmod 775 ${SPLUNK_ANSIBLE_HOME} \
&& chmod 664 ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& sed -i '/^\[defaults\]/a\interpreter_python = /usr/bin/python3' ${SPLUNK_ANSIBLE_HOME}/ansible.cfg \
&& chmod 755 /sbin/entrypoint.sh /sbin/createdefaults.py /sbin/checkstate.sh

USER ${ANSIBLE_USER}
Expand Down

0 comments on commit 9b55b69

Please sign in to comment.