diff options
-rw-r--r-- | .github/reviewers.yml | 7 | ||||
-rw-r--r-- | data/templates/login/pam_radius_auth.conf.j2 | 3 | ||||
-rwxr-xr-x | src/op_mode/bridge.py | 8 | ||||
-rw-r--r-- | src/services/api/graphql/graphql/mutations.py | 3 | ||||
-rw-r--r-- | src/services/api/graphql/graphql/queries.py | 3 |
5 files changed, 17 insertions, 7 deletions
diff --git a/.github/reviewers.yml b/.github/reviewers.yml index c99647bb1..8463681fc 100644 --- a/.github/reviewers.yml +++ b/.github/reviewers.yml @@ -1,3 +1,8 @@ --- "**/*": - - vyos/maintainers + - dmbaturin + - UnicronNL + - zdc + - jestabro + - sever-sever + - c-po diff --git a/data/templates/login/pam_radius_auth.conf.j2 b/data/templates/login/pam_radius_auth.conf.j2 index 1105b60e5..c61154753 100644 --- a/data/templates/login/pam_radius_auth.conf.j2 +++ b/data/templates/login/pam_radius_auth.conf.j2 @@ -16,7 +16,7 @@ {% if radius.server is vyos_defined %} # server[:port] shared_secret timeout source_ip {# .items() returns a tuple of two elements: key and value. 1 relates to the 2nd element i.e. the value and .priority relates to the key from the internal dict #} -{% for server, options in radius.server.items() | sort(attribute='1.priority') if not options.disabled %} +{% for server, options in radius.server.items() | sort(attribute='1.priority') if not 'disable' in options %} {# RADIUS IPv6 servers must be specified in [] notation #} {% if server | is_ipv4 %} {{ server }}:{{ options.port }} {{ "%-25s" | format(options.key) }} {{ "%-10s" | format(options.timeout) }} {{ source_address.ipv4 if source_address.ipv4 is vyos_defined }} @@ -33,4 +33,3 @@ mapped_priv_user radius_priv_user vrf-name {{ radius.vrf }} {% endif %} {% endif %} - diff --git a/src/op_mode/bridge.py b/src/op_mode/bridge.py index fe8dadd70..5a821a287 100755 --- a/src/op_mode/bridge.py +++ b/src/op_mode/bridge.py @@ -22,7 +22,7 @@ import typing from sys import exit from tabulate import tabulate -from vyos.util import cmd +from vyos.util import cmd, rc_cmd from vyos.util import dict_search import vyos.opmode @@ -57,7 +57,11 @@ def _get_raw_data_fdb(bridge): """Get MAC-address for the bridge brX :returns list """ - json_data = cmd(f'sudo bridge --json fdb show br {bridge}') + code, json_data = rc_cmd(f'sudo bridge --json fdb show br {bridge}') + # From iproute2 fdb.c, fdb_show() will only exit(-1) in case of + # non-existent bridge device; raise error. + if code == 255: + raise vyos.opmode.UnconfiguredSubsystem(f"no such bridge device {bridge}") data_dict = json.loads(json_data) return data_dict diff --git a/src/services/api/graphql/graphql/mutations.py b/src/services/api/graphql/graphql/mutations.py index 1b77cff87..5ccc9b0b6 100644 --- a/src/services/api/graphql/graphql/mutations.py +++ b/src/services/api/graphql/graphql/mutations.py @@ -90,11 +90,12 @@ def make_mutation_resolver(mutation_name, class_name, session_func): } except OpModeError as e: typename = type(e).__name__ + msg = str(e) return { "success": False, "errore": ['op_mode_error'], "op_mode_error": {"name": f"{typename}", - "message": op_mode_err_msg.get(typename, "Unknown"), + "message": msg if msg else op_mode_err_msg.get(typename, "Unknown"), "vyos_code": op_mode_err_code.get(typename, 9999)} } except Exception as error: diff --git a/src/services/api/graphql/graphql/queries.py b/src/services/api/graphql/graphql/queries.py index 8ae61b704..b46914dcc 100644 --- a/src/services/api/graphql/graphql/queries.py +++ b/src/services/api/graphql/graphql/queries.py @@ -90,11 +90,12 @@ def make_query_resolver(query_name, class_name, session_func): } except OpModeError as e: typename = type(e).__name__ + msg = str(e) return { "success": False, "errors": ['op_mode_error'], "op_mode_error": {"name": f"{typename}", - "message": op_mode_err_msg.get(typename, "Unknown"), + "message": msg if msg else op_mode_err_msg.get(typename, "Unknown"), "vyos_code": op_mode_err_code.get(typename, 9999)} } except Exception as error: |