From 1340e5db42cdbd7ef899f07536dad3491d81db8e Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 13 Mar 2022 19:08:45 +0000 Subject: [PATCH] Remove the attempted plural 'address(es)', and keep it singular. Fix a typo (addd-ress); update unit tests --- unittest/error-bondethernet4.yaml | 2 +- unittest/error-bridgedomain3.yaml | 4 ++-- unittest/error-subinterface5.yaml | 2 +- validator/bondethernet.py | 2 +- validator/interface.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/unittest/error-bondethernet4.yaml b/unittest/error-bondethernet4.yaml index 593d15c..f2c84c7 100644 --- a/unittest/error-bondethernet4.yaml +++ b/unittest/error-bondethernet4.yaml @@ -2,7 +2,7 @@ test: description: "Members of a BondEthernet can't have addresses" errors: expected: - - "bondethernet .* member .* has address" + - "bondethernet .* member .* has an address" - "bondethernet .* member .* has an LCP" count: 2 --- diff --git a/unittest/error-bridgedomain3.yaml b/unittest/error-bridgedomain3.yaml index 6a08b71..c71ba3d 100644 --- a/unittest/error-bridgedomain3.yaml +++ b/unittest/error-bridgedomain3.yaml @@ -2,8 +2,8 @@ test: description: "Interfaces put into the bridge, can't be L3 (so cannot have an address)" errors: expected: - - "interface .* has adddress.* but no LCP" - - "sub-interface .* has address.* but .* does not have LCP" + - "interface .* has an address but no LCP" + - "sub-interface .* has an address but .* does not have LCP" - "bridgedomain .* member .* has an address" count: 6 --- diff --git a/unittest/error-subinterface5.yaml b/unittest/error-subinterface5.yaml index ef61dbc..3bb5c97 100644 --- a/unittest/error-subinterface5.yaml +++ b/unittest/error-subinterface5.yaml @@ -2,7 +2,7 @@ test: description: "Sub-interface with addresses must have an LCP. Gi1/0/0 does this wrong, while Gi2/0/0 does it correctly" errors: expected: - - "sub-interface .* has address.* but .* does not have LCP" + - "sub-interface .* has an address but .* does not have LCP" --- interfaces: GigabitEthernet1/0/0: diff --git a/validator/bondethernet.py b/validator/bondethernet.py index 7370ade..fe858b2 100644 --- a/validator/bondethernet.py +++ b/validator/bondethernet.py @@ -39,6 +39,6 @@ def validate_bondethernets(yaml): msgs.append("bondethernet %s member %s has an LCP" % (ifname, member)) result = False if interface.has_address(yaml, member): - msgs.append("bondethernet %s member %s has address(es)" % (ifname, member)) + msgs.append("bondethernet %s member %s has an address" % (ifname, member)) result = False return result, msgs diff --git a/validator/interface.py b/validator/interface.py index cccf976..7f037f1 100644 --- a/validator/interface.py +++ b/validator/interface.py @@ -280,7 +280,7 @@ def validate_interfaces(yaml): iface_address = has_address(yaml, ifname) if iface_address and not iface_lcp: - msgs.append("interface %s has adddress(es) but no LCP" % ifname) + msgs.append("interface %s has an address but no LCP" % ifname) result = False if iface_lcp and not unique_lcp(yaml, ifname): lcp = get_lcp(yaml, ifname) @@ -311,7 +311,7 @@ def validate_interfaces(yaml): if has_address(yaml, sub_ifname): ## The sub_iface lcp is not required: it can be derived from the iface_lcp, which has to be set if not iface_lcp: - msgs.append("sub-interface %s has address(es) but %s does not have LCP" % (sub_ifname, ifname)) + msgs.append("sub-interface %s has an address but %s does not have LCP" % (sub_ifname, ifname)) result = False if not valid_encapsulation(yaml, sub_ifname): msgs.append("sub-interface %s has invalid encapsulation" % (sub_ifname))