Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ jobs:
- name: Run tests for tls module
shell: bash {0}
run: bash testing/unit/run_test_module.sh tls captures certAuth certs reports root_certs output
# - name: Run framework tests
# shell: bash {0}
# run: bash testing/unit/run_framework_test.sh
- name: Run tests for risk profiles
shell: bash {0}
run: bash testing/unit/run_report_test.sh testing/unit/risk_profile/risk_profile_test.py
Expand Down
11 changes: 11 additions & 0 deletions framework/python/src/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import typing as t
import netifaces
from common import logger
import tzlocal

LOGGER = logger.get_logger('util')

Expand Down Expand Up @@ -153,3 +154,13 @@ def diff_dicts(d1: t.Dict[t.Any, t.Any], d2: t.Dict[t.Any, t.Any]) -> t.Dict:
if items_added:
diff['items_added'] = items_added
return diff


def get_system_timezone() -> str:
"""Returns the local timezone of the system."""
try:
local_timezone = tzlocal.get_localzone()
return str(local_timezone)
except Exception as e:
LOGGER.error(f'Error getting local timezone: {e}')
return 'UTC'
4 changes: 1 addition & 3 deletions framework/python/src/core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,7 @@ def __init__(self, root_dir):
self.load_certs()

# Fetch the timezone of the host system
tz = util.run_command('cat /etc/timezone')
# TODO: Check if timezone is fetched successfully
self._timezone = tz[0]
self._timezone = util.get_system_timezone()
LOGGER.debug(f'System timezone is {self._timezone}')

# MQTT client
Expand Down
3 changes: 3 additions & 0 deletions framework/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ APScheduler==3.10.4
Jinja2==3.1.6
beautifulsoup4==4.12.3
html5lib==1.1

# Requirements for timezone handling
tzlocal==5.4.3
4 changes: 4 additions & 0 deletions modules/test/base/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ netifaces==0.11.0

# Requirements for reports generation
Jinja2==3.1.6

# Requirements for timezone handling
tzlocal==5.4.3

Loading
Loading