From c18b65bc167764fe182605f1f73e8cb482716fb5 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 26 Jan 2017 23:36:58 -0800 Subject: [PATCH] Refactor DHCP relay docker in sonicv2 style (#217) * Refactor DHCP relay docker in sonicv2 style --- dockers/docker-dhcp-relay/Dockerfile | 6 ++++-- dockers/docker-dhcp-relay/config.sh | 4 ++++ dockers/docker-dhcp-relay/isc-dhcp-relay | 6 ------ dockers/docker-dhcp-relay/isc-dhcp-relay.j2 | 7 +++++++ 4 files changed, 15 insertions(+), 8 deletions(-) create mode 100755 dockers/docker-dhcp-relay/config.sh delete mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay create mode 100644 dockers/docker-dhcp-relay/isc-dhcp-relay.j2 diff --git a/dockers/docker-dhcp-relay/Dockerfile b/dockers/docker-dhcp-relay/Dockerfile index 17cc135342..6ff95da88d 100644 --- a/dockers/docker-dhcp-relay/Dockerfile +++ b/dockers/docker-dhcp-relay/Dockerfile @@ -10,9 +10,11 @@ RUN apt-get update \ && apt-get autoclean -y \ && apt-get autoremove -y -COPY isc-dhcp-relay /etc/default/isc-dhcp-relay +COPY ["isc-dhcp-relay.j2", "/usr/share/dhcp-relay/"] +COPY ["config.sh", "/usr/bin/"] -ENTRYPOINT service rsyslog start \ +ENTRYPOINT /usr/bin/config.sh \ + && service rsyslog start \ && service isc-dhcp-relay start \ && /bin/bash diff --git a/dockers/docker-dhcp-relay/config.sh b/dockers/docker-dhcp-relay/config.sh new file mode 100755 index 0000000000..42146b0343 --- /dev/null +++ b/dockers/docker-dhcp-relay/config.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/dhcp_relay.yml -t /usr/share/dhcp-relay/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay + diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay b/dockers/docker-dhcp-relay/isc-dhcp-relay deleted file mode 100644 index 8aef56c7e1..0000000000 --- a/dockers/docker-dhcp-relay/isc-dhcp-relay +++ /dev/null @@ -1,6 +0,0 @@ -SERVERS="" - -INTERFACES="" - -#-a provides option 82 circuit id information -OPTIONS="-a" diff --git a/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 new file mode 100644 index 0000000000..2d251172c5 --- /dev/null +++ b/dockers/docker-dhcp-relay/isc-dhcp-relay.j2 @@ -0,0 +1,7 @@ +SERVERS="{{ dhcp_servers | join(' ') }}" + +INTERFACES="{{ minigraph_vlan_interfaces | join(' ') }}" + +# '-a' option provides option 82 circuit id information +OPTIONS="-a" +