Update distribution scripts to python3 53/98353/4
authorMiroslav Los <miroslav.los@pantheon.tech>
Wed, 13 Nov 2019 10:15:40 +0000 (11:15 +0100)
committerTimoney, Dan (dt5972) <dtimoney@att.com>
Fri, 13 Dec 2019 14:33:42 +0000 (09:33 -0500)
Also use python3 packages in Dockerfiles.
Make python2 also available for OpenDaylight until they migrate

Signed-off-by: Miroslav Los <miroslav.los@pantheon.tech>
Issue-ID: CCSDK-1923
Change-Id: I3d4453ccbfe191c545ba574695387dd33c129e25

alpine/src/main/docker/Dockerfile
ansible-server/src/main/Dockerfile
dgbuilder/tools/formatXml.py
dgbuilder/tools/format_json.sh
dgbuilder/tools/format_xml.sh
dgbuilder/tools/getRpcsClassFromYang.sh
opendaylight/neon/neon-alpine/src/main/docker/Dockerfile
platform-logic/installer/src/main/scripts/install.sh
ubuntu/src/main/docker/Dockerfile

index 6cbceaf..2e29c4d 100644 (file)
@@ -1,4 +1,4 @@
-# Base ubuntu with added packages needed for open ecomp
+# Base alpine with added packages needed for open ecomp
 FROM alpine:3.8
 MAINTAINER CCSDK  Team (onap-ccsdk@lists.onap.org)
 
 FROM alpine:3.8
 MAINTAINER CCSDK  Team (onap-ccsdk@lists.onap.org)
 
@@ -11,4 +11,4 @@ ENV HTTPS_PROXY ${HTTPS_PROXY}
 ENV https_proxy ${HTTPS_PROXY}
 
 # Add tools needed for OpenDaylight
 ENV https_proxy ${HTTPS_PROXY}
 
 # Add tools needed for OpenDaylight
-RUN apk update && apk --no-cache add bash git openjdk8 maven mysql-client nodejs py-pip graphviz unzip rsync nss
+RUN apk update && apk --no-cache add bash git openjdk8 maven mysql-client nodejs python3 graphviz unzip rsync nss
index 5a1c394..2751a48 100644 (file)
@@ -10,7 +10,6 @@ COPY ansible-server/requirements.txt ansible-server/requirements.txt
 RUN apk add --no-cache curl \
                        iputils \
                        bash \
 RUN apk add --no-cache curl \
                        iputils \
                        bash \
-                       py3-pip \
                        openssh-client \
                        python3 &&\
     apk add --no-cache --virtual .build-deps build-base \
                        openssh-client \
                        python3 &&\
     apk add --no-cache --virtual .build-deps build-base \
index 913456a..7d7d7b6 100644 (file)
@@ -8,4 +8,4 @@ xml_fname=sys.argv[1]
 #print pretty_xml_as_string
 
 x = etree.parse(xml_fname)
 #print pretty_xml_as_string
 
 x = etree.parse(xml_fname)
-print etree.tostring(x, pretty_print = True)
+print(etree.tostring(x, pretty_print = True))
index f86ad3c..5432e7d 100755 (executable)
@@ -1,6 +1,7 @@
+#!/bin/bash
 if [ "$#" != "1" ]
 then
         echo "Usage: $0 jsonFileFullPath"
         exit
 fi
 if [ "$#" != "1" ]
 then
         echo "Usage: $0 jsonFileFullPath"
         exit
 fi
-cat $1|python -m json.tool
+python3 -m json.tool "$1"
index c66153e..fbe368e 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/bash
 if [ "$#" != "1" ]
 then
         echo "Usage: $0 xmlFileFullPath"
 if [ "$#" != "1" ]
 then
         echo "Usage: $0 xmlFileFullPath"
@@ -10,7 +11,7 @@ then
 fi
 if [ -e "$1" ]
 then
 fi
 if [ -e "$1" ]
 then
-       python $PROJECT_HOME/tools/formatXml.py $1
+       python3 $PROJECT_HOME/tools/formatXml.py "$1"
 else
 else
-       echo "File $1 does not exist" 
+       echo "File $1 does not exist"
 fi
 fi
index 3944ed2..d32456b 100755 (executable)
@@ -59,7 +59,7 @@ done
 echo "module.exports = {"
 echo "\"moduleName\" : \"${module}\","
 echo "'${module}_VALUES' : "
 echo "module.exports = {"
 echo "\"moduleName\" : \"${module}\","
 echo "'${module}_VALUES' : "
-echo "[ $allProps ]"|python -m json.tool
+echo "[ $allProps ]"|python3 -m json.tool
 echo ","
 echo "'${module}_RPCS' : ["
 
 echo ","
 echo "'${module}_RPCS' : ["
 
index 950dba6..9d518af 100644 (file)
@@ -1,9 +1,11 @@
-# Base ubuntu with added packages needed for open ecomp
 FROM onap/ccsdk-alpine-image:${project.docker.latestfulltag.version}
 MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org)
 ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
 ENV ODL_HOME /opt/opendaylight/current
 
 FROM onap/ccsdk-alpine-image:${project.docker.latestfulltag.version}
 MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org)
 ENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdk
 ENV ODL_HOME /opt/opendaylight/current
 
+# make python2 also available up until OpenDaylight migrates to python3
+RUN apk add --no-cache py2-pip
+
 # copy the opendaylight tar and expand
 COPY ${odl.karaf.artifactId}-${ccsdk.opendaylight.version}.tar.gz /tmp/
 RUN mkdir -p /opt/odl \
 # copy the opendaylight tar and expand
 COPY ${odl.karaf.artifactId}-${ccsdk.opendaylight.version}.tar.gz /tmp/
 RUN mkdir -p /opt/odl \
@@ -12,7 +14,6 @@ RUN mkdir -p /opt/odl \
     && mv /opt/odl/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} /opt/opendaylight \
     && ln -s  /opt/opendaylight /opt/opendaylight/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} \
     && ln -s /opt/opendaylight /opt/opendaylight/current
     && mv /opt/odl/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} /opt/opendaylight \
     && ln -s  /opt/opendaylight /opt/opendaylight/${odl.karaf.artifactId}-${ccsdk.opendaylight.version} \
     && ln -s /opt/opendaylight /opt/opendaylight/current
 
 # workaround till we get proxy working
 RUN mkdir -p /opt/opendaylight/system/org/mariadb/jdbc/mariadb-java-client/${ccsdk.mariadb-connector-java.version}
 
 # workaround till we get proxy working
 RUN mkdir -p /opt/opendaylight/system/org/mariadb/jdbc/mariadb-java-client/${ccsdk.mariadb-connector-java.version}
index 167c071..18f145a 100644 (file)
@@ -30,7 +30,7 @@ $BASEDIR/bin/svclogic.sh install $BASEDIR $BASEDIR/config/svclogic.properties
 
 end=$(date +%s.%N)
 echo "Load and activate finished at $(date)"
 
 end=$(date +%s.%N)
 echo "Load and activate finished at $(date)"
-runtime=$(python -c "print(${end} - ${start})")
+runtime=$(python3 -c "print(${end} - ${start})")
 echo "Load and activate took $runtime seconds"
 
 
 echo "Load and activate took $runtime seconds"
 
 
index e2eb9b5..7dfe244 100644 (file)
@@ -12,4 +12,4 @@ RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy  \"${HTTP_PROXY}\
     if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi
 
 # Add tools needed for OpenDaylight
     if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi
 
 # Add tools needed for OpenDaylight
-RUN apt-get update && apt-get install -y git openjdk-8-jdk maven mysql-client nodejs nodejs-legacy python-pip graphviz npm unzip
+RUN apt-get update && apt-get install -y git openjdk-8-jdk maven mysql-client nodejs nodejs-legacy python3-pip graphviz npm unzip