Skip to content

Commit

Permalink
resolves type errors and key errors
Browse files Browse the repository at this point in the history
Signed-off-by: Arham-Nasir <arqamnasir719@gmail.com>
  • Loading branch information
Arham-Nasir committed Sep 17, 2024
1 parent fc7645a commit f42d768
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions scripts/hostcfgd
Original file line number Diff line number Diff line change
Expand Up @@ -1792,10 +1792,9 @@ class Memory_StatisticsCfg(object):
"""
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
syslog.syslog(syslog.LOG_INFO, output.decode('utf-8'))
except subprocess.CalledProcessError as e:
syslog.syslog(syslog.LOG_ERR, e.output.decode('utf-8'))

syslog.syslog(syslog.LOG_INFO, output.decode('utf-8')) # Ensure proper decoding
except subprocess.CalledProcessError as e: # Make sure subprocess is imported correctly
syslog.syslog(syslog.LOG_ERR, str(e))

class SerialConsoleCfg:

Expand Down
8 changes: 4 additions & 4 deletions tests/hostcfgd/hostcfgd_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,14 @@ def load(init_data):
print("Memory statistics configuration not found.")

def test_memory_statistics_event(self):
HOSTCFG_DAEMON_CFG_DB = {
HOSTCFG_DAEMON_INIT_CFG_DB = {
'MEMORY_STATISTICS': {
'config': {
'enabled': 'true',
'retention_time': '15 days',
'sampling_interval': '5 minutes'
'retention_time': '15',
'sampling_interval': '5'
}
}
},
}

MockConfigDb.set_config_db(HOSTCFG_DAEMON_CFG_DB)
Expand Down

0 comments on commit f42d768

Please sign in to comment.