Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1640499 > unrolled thread

[PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config

Started byHaiyang Zhang <haiyangz@exchange.microsoft.com>
First post2017-05-12 16:20 +0200
Last post2017-05-12 20:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config Haiyang Zhang <haiyangz@exchange.microsoft.com> - 2017-05-12 16:20 +0200
    Re: [PATCH net-next] tools: hv: Add clean up for included files in  Ubuntu net config David Miller <davem@davemloft.net> - 2017-05-12 18:30 +0200
      RE: [PATCH net-next] tools: hv: Add clean up for included files in  Ubuntu net config Haiyang Zhang <haiyangz@microsoft.com> - 2017-05-12 20:50 +0200

#1640499 — [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config

FromHaiyang Zhang <haiyangz@exchange.microsoft.com>
Date2017-05-12 16:20 +0200
Subject[PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config
Message-ID<tGjAe-5JJ-13@gated-at.bofh.it>
From: Haiyang Zhang <haiyangz@microsoft.com>

The clean up function is updated to cover duplicate config info in
files included by "source" key word in Ubuntu network config.

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
---
 tools/hv/bondvf.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/tools/hv/bondvf.sh b/tools/hv/bondvf.sh
index d85968c..1f42604 100755
--- a/tools/hv/bondvf.sh
+++ b/tools/hv/bondvf.sh
@@ -102,15 +102,29 @@ function create_bond_cfg_redhat {
 }
 
 function del_eth_cfg_ubuntu {
-	local fn=$cfgdir/interfaces
+	local mainfn=$cfgdir/interfaces
+	local fnlist=( $mainfn )
+
+	local dirlist=(`awk '/^[ \t]*source/{print $2}' $mainfn`)
+
+	local i
+	for i in "${dirlist[@]}"
+	do
+		fnlist+=(`ls $i 2>/dev/null`)
+	done
+
 	local tmpfl=$(mktemp)
 
 	local nic_start='^[ \t]*(auto|iface|mapping|allow-.*)[ \t]+'$1
 	local nic_end='^[ \t]*(auto|iface|mapping|allow-.*|source)'
 
+	local fn
+	for fn in "${fnlist[@]}"
+	do
 	awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1"  $fn >$tmpfl
 
 	cp $tmpfl $fn
+	done
 
 	rm $tmpfl
 }
-- 
1.7.1

[toc] | [next] | [standalone]


#1640572 — Re: [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config

FromDavid Miller <davem@davemloft.net>
Date2017-05-12 18:30 +0200
SubjectRe: [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config
Message-ID<tGlC2-7aB-9@gated-at.bofh.it>
In reply to#1640499
From: Haiyang Zhang <haiyangz@exchange.microsoft.com>
Date: Fri, 12 May 2017 07:13:33 -0700

>  
> +	local fn
> +	for fn in "${fnlist[@]}"
> +	do
>  	awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1"  $fn >$tmpfl
>  
>  	cp $tmpfl $fn
> +	done

Please indent the body of this loop properly.

[toc] | [prev] | [next] | [standalone]


#1640686 — RE: [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config

FromHaiyang Zhang <haiyangz@microsoft.com>
Date2017-05-12 20:50 +0200
SubjectRE: [PATCH net-next] tools: hv: Add clean up for included files in Ubuntu net config
Message-ID<tGnNw-gZ-15@gated-at.bofh.it>
In reply to#1640572

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Friday, May 12, 2017 12:20 PM
> To: Haiyang Zhang <haiyangz@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>
> Cc: netdev@vger.kernel.org; KY Srinivasan <kys@microsoft.com>;
> olaf@aepfle.de; vkuznets@redhat.com; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net-next] tools: hv: Add clean up for included files
> in Ubuntu net config
> 
> From: Haiyang Zhang <haiyangz@exchange.microsoft.com>
> Date: Fri, 12 May 2017 07:13:33 -0700
> 
> >
> > +	local fn
> > +	for fn in "${fnlist[@]}"
> > +	do
> >  	awk "/$nic_end/{x=0} x{next} /$nic_start/{x=1;next} 1"
> $fn >$tmpfl
> >
> >  	cp $tmpfl $fn
> > +	done
> 
> Please indent the body of this loop properly.

Will do. Thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web