From f6026f94a5d546dd454b1c69481772d55c6bc13b Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Tue, 3 Mar 2020 23:52:53 -0800 Subject: [PATCH] More fun with dupes --- controller/PostgreSQL.cpp | 7 ++++++- ext/central-controller-docker/Dockerfile | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/controller/PostgreSQL.cpp b/controller/PostgreSQL.cpp index be9083303..2be90f448 100644 --- a/controller/PostgreSQL.cpp +++ b/controller/PostgreSQL.cpp @@ -530,7 +530,12 @@ void PostgreSQL::initializeMembers(PGconn *conn) int n = PQntuples(r2); for (int j = 0; j < n; ++j) { - config["ipAssignments"].push_back(PQgetvalue(r2, j, 0)); + std::string ipaddr = PQgetvalue(r2, j, 0); + std::size_t pos = ipaddr.find('/'); + if (pos != std::string::npos) { + ipaddr = ipaddr.substr(0, pos); + } + config["ipAssignments"].push_back(ipaddr); } _memberChanged(empty, config, false); diff --git a/ext/central-controller-docker/Dockerfile b/ext/central-controller-docker/Dockerfile index 8ded3e64a..12984ebda 100644 --- a/ext/central-controller-docker/Dockerfile +++ b/ext/central-controller-docker/Dockerfile @@ -10,10 +10,10 @@ RUN yum -y install epel-release && yum -y update && yum clean all RUN yum groupinstall -y "Development Tools" RUN yum install -y bash postgresql10 postgresql10-devel libpqxx-devel glibc-static libstdc++-static clang jemalloc jemalloc-devel -RUN git clone http://git.int.zerotier.com/zerotier/ZeroTierOne.git -RUN if [ "$git_branch" != "master" ]; then cd ZeroTierOne && git checkout -b $git_branch origin/$git_branch; fi -RUN ldconfig -RUN cd ZeroTierOne && make central-controller +# RUN git clone http://git.int.zerotier.com/zerotier/ZeroTierOne.git +# RUN if [ "$git_branch" != "master" ]; then cd ZeroTierOne && git checkout -b $git_branch origin/$git_branch; fi +ADD . /ZeroTierOne +RUN cd ZeroTierOne && make clean && make central-controller FROM centos:7 RUN yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm && yum -y install epel-release && yum -y update && yum clean all