Skip to content

Commit

Permalink
Merge pull request #265 from Cray-HPE/CASMTRIAGE-1900
Browse files Browse the repository at this point in the history
CASMTRIAGE-1900: Add jinja render to rootfs_provider_passthrough to support iSCSI
  • Loading branch information
annapoorna-s-alt authored Sep 27, 2024
2 parents 6e4173f + df8e1b8 commit e7b8cda
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.32.4] - 2024-09-27

### Added
- Add jinja rendering of rootfs_provider_passthrough value for the boot_set to create session
template with iSCSI values.

## [3.32.3] - 2024-09-27

### Added
Expand Down
7 changes: 6 additions & 1 deletion sat/cli/bootprep/input/base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2021-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2021-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -242,6 +242,11 @@ def name(self):
# items that inherit from BaseInputItem.
return self.data['name']

@property
def boot_set(self):
"""Return the full boot_sets dictionary."""
return self.data.get('bos_parameters', {}).get('boot_sets', {})

def __str__(self):
# Since the name can be rendered, and when unrendered, it does not need
# to be unique, just refer to this item by its index in the instance.
Expand Down
6 changes: 6 additions & 0 deletions sat/cli/bootprep/input/session_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ def get_create_item_data(self):
boot_set_api_data.update(boot_set_data)
api_data['boot_sets'][boot_set_name] = boot_set_api_data

# Fetch full boot sets
boot_sets = self.boot_set
# Render the rootfs_provider_passthrough using Jinja2
rendered_rootfs = self.jinja_env.from_string(
boot_sets[boot_set_name]['rootfs_provider_passthrough']).render(self.data)
api_data['boot_sets'][boot_set_name]['rootfs_provider_passthrough'] = rendered_rootfs
return api_data

def get_image_record_by_id(self, ims_image_id):
Expand Down
6 changes: 4 additions & 2 deletions tests/cli/bootprep/input/test_session_template.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2023-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -92,10 +92,12 @@ def get_input_and_expected_bos_data(self, name='my-session-template',
bos_payload_bootsets = {}
for boot_set_name, boot_set_arch in arch_by_bootset.items():
input_bootsets[boot_set_name] = {
'node_roles_groups': ['Compute']
'node_roles_groups': ['Compute'],
'rootfs_provider_passthrough': "dvs:api-gw-service-nmn.local:300:hsn0,nmn0:0"
}
bos_payload_bootsets[boot_set_name] = {
'node_roles_groups': ['Compute'],
'rootfs_provider_passthrough': "dvs:api-gw-service-nmn.local:300:hsn0,nmn0:0",
'path': self.mock_path,
'etag': self.mock_etag,
'type': self.mock_image_type
Expand Down

0 comments on commit e7b8cda

Please sign in to comment.