On 06/18/15 at 10:22am, Dave Young wrote:
On 06/15/15 at 09:29pm, Minfei Huang wrote:
> Now Kdump will ingore the DNS config in /etc/resolv.conf, when it
> generates the initram. And most users do not concern about this issue,
> because they never use deployment tools to configure machines
> environment, like puppet.
>
> It is more convenient to add the DNS config to /etc/resolv.conf for
> people who use deployment tools to configure machines concurrently.
>
> Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
> ---
> dracut-module-setup.sh | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
> index 73ab938..ad842b2 100755
> --- a/dracut-module-setup.sh
> +++ b/dracut-module-setup.sh
> @@ -64,10 +64,26 @@ kdump_is_vlan() {
>
> # $1: netdev name
> kdump_setup_dns() {
> - _dnsfile=${initdir}/etc/cmdline.d/42dns.conf
> + local _nameserver _dns
> + local _dnsfile=${initdir}/etc/cmdline.d/42dns.conf
> . /etc/sysconfig/network-scripts/ifcfg-$1
> +
> + touch $_dnsfile
no need to touch it..
The warning will be raised, since we use "cat $_dnsfile" to echo the
content directly, without touching the $_dnsfile.
Ok, I will do the judgement before using "cat $_dnsfile".
> [ -n "$DNS1" ] && echo
"nameserver=$DNS1" > "$_dnsfile"
> [ -n "$DNS2" ] && echo "nameserver=$DNS2" >>
"$_dnsfile"
> +
> + while read content;
> + do
> + _nameserver=$(echo $content | grep ^nameserver)
> + [ -z "$_nameserver" ] && continue
> +
> + _dns=$(echo $_nameserver | cut -d' ' -f2)
> + [ -z "$_dns" ] && continue
> +
> + if ! $(cat $_dnsfile | grep -q $_dns); then
> + echo "nameserver=$_dns" >> "$_dnsfile"
> + fi
> + done < "/etc/resolv.conf"
Can one manually setup /etc/resolv.conf and at the same time NM also manage
it?
I think so. For the large amounts of machines, user may prefer to use
the script to manage the configuration.
I suspect only handle them exclusively should be ok, like below:
[ -z "$DNS1" ] && [ -z "$DNS2" ] && parse_resolv_conf
Maybe we can only parse the /etc/resolv.conf to add the DNS to
$_dnsfile, because NM will put the corresponding DNS to
/etc/resolv.conf, although we setup it in the ifcfg-*.
Thanks
Minfei
> }
>
> #$1: netdev name
> --
> 2.1.0
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec
>
>