fff-gateway: make uci query for vlan ports quiet

Submitted by Fabian Blaese on April 17, 2020, 1:51 p.m.

Details

Message ID 20200417135148.64669-1-fabian@blaese.de
State Accepted
Headers show

Commit Message

Fabian Blaese April 17, 2020, 1:51 p.m.
The user might create a vlan without any ports.
This setup lead to "uci: Entry not found" error messages,
while still working as intended.

The '-q' flag is added to the corresponding uci query to
hide this error. While this isn't strictly necessary, the
uci subcommand is quoted to bring it in line with the other
subcommands.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan b/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
index cfc8e69..a46bcd5 100644
--- a/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
+++ b/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
@@ -10,7 +10,7 @@  BOARD="$(uci get board.model.name)"
 configure() {
 	add_vlan() {
 		local vlan="$1"
-		local ports=$(uci get gateway.$vlan.ports)
+		local ports="$(uci -q get gateway.$vlan.ports)"
 		local name="$SWITCHDEV"_$vlan
 
 		uci set network.$name='switch_vlan'

Comments

Adrian Schmutzler April 17, 2020, 2:04 p.m.
Hallo,

gibt ein Leerzeichen am Ende der Portliste:

option ports '0t '

Keine Ahnung, ob der das frisst oder ob man das nochmal trimmen sollte.

Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Freitag, 17. April 2020 15:52
> To: franken-dev@freifunk.net
> Subject: [PATCH] fff-gateway: make uci query for vlan ports quiet
> 
> The user might create a vlan without any ports.
> This setup lead to "uci: Entry not found" error messages, while still working as
> intended.
> 
> The '-q' flag is added to the corresponding uci query to hide this error. While
> this isn't strictly necessary, the uci subcommand is quoted to bring it in line
> with the other subcommands.
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
> b/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
> index cfc8e69..a46bcd5 100644
> --- a/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
> +++ b/src/packages/fff/fff-gateway/files/etc/gateway.d/20-vlan
> @@ -10,7 +10,7 @@ BOARD="$(uci get board.model.name)"
>  configure() {
>  	add_vlan() {
>  		local vlan="$1"
> -		local ports=$(uci get gateway.$vlan.ports)
> +		local ports="$(uci -q get gateway.$vlan.ports)"
>  		local name="$SWITCHDEV"_$vlan
> 
>  		uci set network.$name='switch_vlan'
> --
> 2.26.0
Fabian Blaese April 17, 2020, 2:07 p.m.
Hallo Adrian,

On 17.04.20 16:04, mail@adrianschmutzler.de wrote:
> Hallo,
> 
> gibt ein Leerzeichen am Ende der Portliste:
> 
> option ports '0t '
das ist scheinbar kein Problem.
Ich vermute, dass der OpenWrt Mechanismus da einfach mit einem "for x in" drüber iteriert.

Gruß
Fabian
Fabian Blaese April 17, 2020, 3:09 p.m.
applied.