Check if attribute 'tmpfs_percentage' exist

Attribute 'tmpfs_percentage' is set only when build-pkgs is executed
with argument '--tmpfs_percentage'. This change verify if attribute
'tmpfs_percentage' is set before passing it to clonechroot function.

Test plan:
    PASS - Run build-pkgs without --tmpfs_percentage
    PASS - Run build-pkgs with --tmpfs_percentage

Closes-bug: 2083023

Change-Id: I064328d29f0c3a2592589d0e0ac964f76bb3e5ed
Signed-off-by: Dostoievski Batista <dostoievski.albinobatista@windriver.com>
This commit is contained in:
Dostoievski Batista 2024-09-27 09:05:35 -03:00
parent b1c28c0cdb
commit 53a23581da

View File

@ -966,7 +966,10 @@ class BuildController():
if 'success' in ret:
logger.debug('Parent chroot is ready to create children chroots')
ret_status = req_chroots_action('clonechroot', {'instances': self.attrs['parallel'], 'tmpfs_percentage': self.attrs['tmpfs_percentage']})
extra_args = {'instances': self.attrs['parallel']}
if hasattr(self, 'tmpfs_percentage'):
extra_args['tmpfs_percentage'] = self.attrs['tmpfs_percentage']
ret_status = req_chroots_action('clonechroot', extra_args)
if not 'success' == ret_status:
logger.error("Failed to clone children chroots")
else: