Skip to content

Commit

Permalink
add sonic_asic_platform in the render context when rendering docker_i…
Browse files Browse the repository at this point in the history
…mage_ctl.j2
  • Loading branch information
BYGX-wcr committed Dec 10, 2024
1 parent 03d8335 commit 49cd501
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sonic_package_manager/service_creator/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
from sonic_package_manager.service_creator.sonic_db import SonicDB
from sonic_package_manager.service_creator.utils import in_chroot

from sonic_py_common import device_info


SERVICE_FILE_TEMPLATE = 'sonic.service.j2'

Expand Down Expand Up @@ -254,6 +256,9 @@ def generate_container_mgmt(self, package: Package):
script_path = os.path.join(DOCKER_CTL_SCRIPT_LOCATION, f'{name}.sh')
script_template = get_tmpl_path(DOCKER_CTL_SCRIPT_TEMPLATE)
run_opt = []
sonic_asic_platform = os.environ.get("CONFIGURED_PLATFORM")
if sonic_asic_platform == None:
sonic_asic_platform = device_info.get_platform_info().get('asic_type', None)

if container_spec['privileged']:
run_opt.append('--privileged')
Expand All @@ -278,6 +283,7 @@ def generate_container_mgmt(self, package: Package):
'docker_container_name': name,
'docker_image_id': image_id,
'docker_image_run_opt': run_opt,
'sonic_asic_platform': sonic_asic_platform
}
render_template(script_template, script_path, render_ctx, executable=True)
log.info(f'generated {script_path}')
Expand Down

0 comments on commit 49cd501

Please sign in to comment.