Fix py3 gate

Netaddr library is supported in py2 and py3. We should be using it
instead of relying on ipaddress, which is only supported in py3.

Also in order to unblock the gate this makes sure stable
upper-constraints are used in container builds.

Co-Authored-By: Michał Dulko <mdulko@redhat.com>
Change-Id: I93ee6343a66de1adcaca800e0614da72a4df60d9
(cherry picked from commit 971b2ee3bf)
This commit is contained in:
Maysa Macedo 2019-11-06 11:28:50 +01:00 committed by Michał Dulko
parent 28af913826
commit afac4f2577
5 changed files with 9 additions and 9 deletions

View File

@ -7,7 +7,7 @@ RUN go build -o /go/bin/kuryr-cni ./kuryr_cni
FROM centos:7 FROM centos:7
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>" LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/train"
ARG OSLO_LOCK_PATH=/var/kuryr-lock ARG OSLO_LOCK_PATH=/var/kuryr-lock
RUN yum install -y epel-release https://rdoproject.org/repos/rdo-release.rpm \ RUN yum install -y epel-release https://rdoproject.org/repos/rdo-release.rpm \

View File

@ -7,7 +7,7 @@ RUN go build -o /go/bin/kuryr-cni ./kuryr_cni
FROM fedora:30 FROM fedora:30
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>" LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/train"
ARG OSLO_LOCK_PATH=/var/kuryr-lock ARG OSLO_LOCK_PATH=/var/kuryr-lock
RUN dnf update -y \ RUN dnf update -y \

View File

@ -1,7 +1,7 @@
FROM centos:7 FROM centos:7
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>" LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/train"
RUN yum install -y epel-release \ RUN yum install -y epel-release \
&& yum install -y --setopt=tsflags=nodocs python-pip libstdc++ \ && yum install -y --setopt=tsflags=nodocs python-pip libstdc++ \

View File

@ -1,7 +1,7 @@
FROM fedora:30 FROM fedora:30
LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>" LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Michał Dulko<mdulko@redhat.com>"
ARG UPPER_CONSTRAINTS_FILE="https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt" ARG UPPER_CONSTRAINTS_FILE="https://releases.openstack.org/constraints/upper/train"
RUN dnf update -y \ RUN dnf update -y \
&& dnf install -y --setopt=tsflags=nodocs python36 libstdc++ \ && dnf install -y --setopt=tsflags=nodocs python36 libstdc++ \

View File

@ -163,11 +163,11 @@ function _allocation_range {
python - <<EOF "$@" python - <<EOF "$@"
import sys import sys
from ipaddress import ip_network from netaddr import IPNetwork
import six import six
n = ip_network(six.text_type(sys.argv[1])) n = IPNetwork(six.text_type(sys.argv[1]))
gateway_position = sys.argv[2] gateway_position = sys.argv[2]
if gateway_position == 'beginning': if gateway_position == 'beginning':
@ -1013,12 +1013,12 @@ function split_subnet {
python - <<EOF "$@" python - <<EOF "$@"
import sys import sys
from ipaddress import ip_network from netaddr import IPNetwork
import six import six
n = ip_network(six.text_type(sys.argv[1])) n = IPNetwork(six.text_type(sys.argv[1]))
first, last = n.subnets(prefixlen_diff=1) first, last = n.subnet(n.prefixlen+1)
print("%s\\t%s" % (first, last)) print("%s\\t%s" % (first, last))
EOF EOF