From e38c7397d4a7f427bef1dfebf3e7d329d895ec1e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 17 Feb 2020 21:22:20 +0100 Subject: snmp: get_config_value() should return str not list --- scripts/cli/test_service_snmp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/cli/test_service_snmp.py b/scripts/cli/test_service_snmp.py index 2f918c929..e46b4b588 100755 --- a/scripts/cli/test_service_snmp.py +++ b/scripts/cli/test_service_snmp.py @@ -30,7 +30,8 @@ base_path = ['service', 'snmp'] def get_config_value(key): tmp = read_file(SNMPD_CONF) - return re.findall(r'\n?{}\s+(.*)'.format(key), tmp) + tmp = re.findall(r'\n?{}\s+(.*)'.format(key), tmp) + return tmp[0] class TestSNMPService(unittest.TestCase): def setUp(self): @@ -70,7 +71,7 @@ class TestSNMPService(unittest.TestCase): # verify listen address, it will be returned as # ['unix:/run/snmpd.socket,udp:127.0.0.1:161,udp6:[::1]:161'] # thus we need to transfor this into a proper list - config = get_config_value('agentaddress')[0] + config = get_config_value('agentaddress') expected = 'unix:/run/snmpd.socket' for addr in listen: if is_ipv4(addr): @@ -100,6 +101,7 @@ class TestSNMPService(unittest.TestCase): # create user for authpriv in ['auth', 'privacy']: self.session.set(base_path + ['v3', 'user', 'vyos', authpriv, 'plaintext-key', 'vyos1234']) + self.session.set(base_path + ['v3', 'user', 'vyos', 'group', 'default']) # TODO: read in config file and check values -- cgit v1.2.3