[PATCH compass-ci 1/2] feat(dnsmasq): allow the use of custom dnsmasq conf file

The custom dnsmasq conf files should be placed under the follow dir: /etc/compass-ci/dnsmasq.d/ Signed-off-by: Yu Chuan <13186087857@163.com> --- container/dnsmasq/start | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/container/dnsmasq/start b/container/dnsmasq/start index 3cad801ec81c..8e0e05c953fb 100755 --- a/container/dnsmasq/start +++ b/container/dnsmasq/start @@ -8,6 +8,10 @@ docker_rm dnsmasq kill $(ps -ef| grep dnsmasq| grep libvirt| awk '{print $2}') 2> /dev/null +# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/ + cmd=( docker run --restart=always -- 2.23.0

On Tue, Sep 29, 2020 at 02:57:50PM +0800, Yu Chuan wrote:
The custom dnsmasq conf files should be placed under the follow dir: /etc/compass-ci/dnsmasq.d/
Signed-off-by: Yu Chuan <13186087857@163.com> --- container/dnsmasq/start | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/container/dnsmasq/start b/container/dnsmasq/start index 3cad801ec81c..8e0e05c953fb 100755 --- a/container/dnsmasq/start +++ b/container/dnsmasq/start @@ -8,6 +8,10 @@ docker_rm dnsmasq
kill $(ps -ef| grep dnsmasq| grep libvirt| awk '{print $2}') 2> /dev/null
+# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/
i feel $PWD is not safe. if the scripy called under /home/xxx the $PWD is /home/xxx Thanks, Shenwei
+ cmd=( docker run --restart=always -- 2.23.0

On Tue, Sep 29, 2020 at 03:04:45PM +0800, Xiao Shenwei wrote:
On Tue, Sep 29, 2020 at 02:57:50PM +0800, Yu Chuan wrote:
The custom dnsmasq conf files should be placed under the follow dir: /etc/compass-ci/dnsmasq.d/
Signed-off-by: Yu Chuan <13186087857@163.com> --- container/dnsmasq/start | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/container/dnsmasq/start b/container/dnsmasq/start index 3cad801ec81c..8e0e05c953fb 100755 --- a/container/dnsmasq/start +++ b/container/dnsmasq/start @@ -8,6 +8,10 @@ docker_rm dnsmasq
kill $(ps -ef| grep dnsmasq| grep libvirt| awk '{print $2}') 2> /dev/null
+# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/
i feel $PWD is not safe. if the scripy called under /home/xxx the $PWD is /home/xxx
good, i use this follow the old code, so maybe i need modify the old code too. -------- Thanks Yu Chuan
Thanks, Shenwei
+ cmd=( docker run --restart=always -- 2.23.0

It looks good to me. Thanks, Xijian On Tue, Sep 29, 2020 at 02:57:50PM +0800, Yu Chuan wrote:
The custom dnsmasq conf files should be placed under the follow dir: /etc/compass-ci/dnsmasq.d/
Signed-off-by: Yu Chuan <13186087857@163.com> --- container/dnsmasq/start | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/container/dnsmasq/start b/container/dnsmasq/start index 3cad801ec81c..8e0e05c953fb 100755 --- a/container/dnsmasq/start +++ b/container/dnsmasq/start @@ -8,6 +8,10 @@ docker_rm dnsmasq
kill $(ps -ef| grep dnsmasq| grep libvirt| awk '{print $2}') 2> /dev/null
+# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/ + cmd=( docker run --restart=always -- 2.23.0

On Tue, Sep 29, 2020 at 02:57:50PM +0800, Yu Chuan wrote:
The custom dnsmasq conf files should be placed under the follow dir: /etc/compass-ci/dnsmasq.d/
Signed-off-by: Yu Chuan <13186087857@163.com> --- container/dnsmasq/start | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/container/dnsmasq/start b/container/dnsmasq/start index 3cad801ec81c..8e0e05c953fb 100755 --- a/container/dnsmasq/start +++ b/container/dnsmasq/start @@ -8,6 +8,10 @@ docker_rm dnsmasq
kill $(ps -ef| grep dnsmasq| grep libvirt| awk '{print $2}') 2> /dev/null
+# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/ +
Are there directories under 'dnsmasq.d'? Copy 'dnsmasq.d' directly may be better, `cp dir/* dest/' will not contain dot files. so 'cp -r /etc/compass-ci/dnsmasq.d ${PWD}/'? Thanks, RenWen
cmd=( docker run --restart=always -- 2.23.0

+# load custom dnsmasq.conf +[ -d "/etc/compass-ci/dnsmasq.d/" ] && + cp /etc/compass-ci/dnsmasq.d/* ${PWD}/dnsmasq.d/ +
Are there directories under 'dnsmasq.d'?
No.
Copy 'dnsmasq.d' directly may be better, `cp dir/* dest/' will not contain dot files. so 'cp -r /etc/compass-ci/dnsmasq.d ${PWD}/'?
But your advice is a very good point, surely I need take care of the code compatibility. -------- Thanks Yu Chuan
Thanks, RenWen
cmd=( docker run --restart=always -- 2.23.0
participants (4)
-
Ren Wen
-
Xiao Shenwei
-
Xu Xijian
-
Yu Chuan