Skip to content

Commit f42d768

Browse files
committed
resolves type errors and key errors
Signed-off-by: Arham-Nasir <arqamnasir719@gmail.com>
1 parent fc7645a commit f42d768

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

scripts/hostcfgd

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,10 +1792,9 @@ class Memory_StatisticsCfg(object):
17921792
"""
17931793
try:
17941794
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
1795-
syslog.syslog(syslog.LOG_INFO, output.decode('utf-8'))
1796-
except subprocess.CalledProcessError as e:
1797-
syslog.syslog(syslog.LOG_ERR, e.output.decode('utf-8'))
1798-
1795+
syslog.syslog(syslog.LOG_INFO, output.decode('utf-8')) # Ensure proper decoding
1796+
except subprocess.CalledProcessError as e: # Make sure subprocess is imported correctly
1797+
syslog.syslog(syslog.LOG_ERR, str(e))
17991798

18001799
class SerialConsoleCfg:
18011800

tests/hostcfgd/hostcfgd_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,14 +361,14 @@ def load(init_data):
361361
print("Memory statistics configuration not found.")
362362

363363
def test_memory_statistics_event(self):
364-
HOSTCFG_DAEMON_CFG_DB = {
364+
HOSTCFG_DAEMON_INIT_CFG_DB = {
365365
'MEMORY_STATISTICS': {
366366
'config': {
367367
'enabled': 'true',
368-
'retention_time': '15 days',
369-
'sampling_interval': '5 minutes'
368+
'retention_time': '15',
369+
'sampling_interval': '5'
370370
}
371-
}
371+
},
372372
}
373373

374374
MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB)

0 commit comments

Comments
 (0)