Skip to content

Commit 64567f9

Browse files
committed
testbed_info and clean_info optional discovery fields
1 parent fa50155 commit 64567f9

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/pyatsimagebuilder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
from .builder import ImageBuilder
33

44
# metadata
5-
__version__ = '24.1'
5+
__version__ = '24.2'
66
__author__ = 'Cisco Systems Inc.'

src/pyatsimagebuilder/utils.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -490,21 +490,22 @@ def discover_manifests(search_path, ignore_folders=None, relative_path=None,
490490
def _process_testbed_file(profile, yaml_contents):
491491
# Extract specific device information from each device
492492
# in the testbed and attach to the profile
493-
testbed_info = profile.setdefault('testbed_info', {})
494-
for dev_name, dev in yaml_contents['devices'].items():
495-
if isinstance(dev, dict):
496-
testbed_info[dev_name] = {}
497-
for key in ('os', 'platform', 'model', 'pid', 'type', 'logical'):
498-
if key in dev:
499-
testbed_info[dev_name][key] = dev[key]
493+
if yaml_contents.get('devices'):
494+
testbed_info = profile.setdefault('testbed_info', {})
495+
for dev_name, dev in yaml_contents['devices'].items():
496+
if isinstance(dev, dict):
497+
testbed_info[dev_name] = {}
498+
for key in ('os', 'platform', 'model', 'pid', 'type', 'logical'):
499+
if key in dev:
500+
testbed_info[dev_name][key] = dev[key]
500501

501502
def _process_clean_file(profile, yaml_contents):
502503
# Extract bringup information from the clean file and
503504
# attach to the profile
504-
clean_info = profile.setdefault('clean_info', {})
505505
bringup_module = yaml_contents.get('bringup', {}).get('BringUpWorker', {}).get('module')
506-
clean_info['bringup_module'] = bringup_module
507-
506+
if bringup_module:
507+
clean_info = profile.setdefault('clean_info', {})
508+
clean_info['bringup_module'] = bringup_module
508509

509510
yaml_processors = {
510511
'testbed-file': _process_testbed_file,

0 commit comments

Comments
 (0)