Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mharding-hpe committed Sep 18, 2024
1 parent 7e2f2e8 commit e12aae3
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions cray/modules/bos/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
""" bos """
# pylint: disable=invalid-name
import json
import sys
#import sys

from cray.constants import FROM_FILE_TAG
from cray.core import option
Expand Down Expand Up @@ -108,7 +108,7 @@ def create_patch_shim(func):
def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, clear_pending_state,
**kwargs):
dbg(f"create_patch_shim decorator kwargs={kwargs}")
sys.stderr.write(f"create_patch_shim decorator kwargs={kwargs}\n")
#sys.stderr.write(f"create_patch_shim decorator kwargs={kwargs}\n")
filter_ids = filter_ids["value"]
filter_session = filter_session["value"]
if not (filter_ids or filter_session):
Expand All @@ -132,7 +132,7 @@ def _decorator(filter_ids, filter_session, patch, enabled, retry_policy, clear_p
payload["patch"]["enabled"] = enabled["value"]
if retry_policy["value"] is not None:
payload["patch"]["retry_policy"] = retry_policy["value"]
if clear_pending_state:
if clear_pending_state["value"]:
empty_boot_artifacts = {
"initrd": "",
"kernel_parameters": "",
Expand Down Expand Up @@ -223,26 +223,30 @@ def setup_components_patch():
dbg(f'updatemany-after: {param}')
new_command.callback = create_patch_shim(new_command.callback)

STAGED_STATE_ARGS=[
'staged-state-session',
'staged-state-configuration',
'staged-state-boot-artifacts-initrd',
'staged-state-boot-artifacts-kernel-parameters',
'staged-state-boot-artifacts-kernel' ]

DESIRED_STATE_ARGS=[
'desired-state-bss-token',
'desired-state-configuration',
'desired-state-boot-artifacts-initrd',
'desired-state-boot-artifacts-kernel-parameters',
'desired-state-boot-artifacts-kernel' ]

def create_patch_compnent_shim(func):
""" Callback function to custom create our own payload """

def _decorator(clear_pending_state, **kwargs):
dbg(f"create_patch_compnent_shim decorator kwargs={kwargs}")
sys.stderr.write(f"create_patch_component_shim decorator kwargs={kwargs}\n")
if clear_pending_state:
#sys.stderr.write(f"create_patch_component_shim decorator kwargs={kwargs}\n")
if clear_pending_state["value"]:
kwargs.update({
"staged_state_session": "",
"staged_state_configuration": "",
"staged_state_boot_artifacts_initrd ": "",
"staged_state_boot_artifacts_kernel_parameters": "",
"staged_state_boot_artifacts_kernel": "",
"desired_state_bss_token": "",
"desired_state_configuration": "",
"desired_state_boot_artifacts_initrd": "",
"desired_state_boot_artifacts_kernel_parameters": "",
"desired_state_boot_artifacts_kernel": ""})
kwargs[FROM_FILE_TAG] = {"name": FROM_FILE_TAG}
arg.replace('-','_'): { "name": arg, "value": "" }
for arg in STAGED_STATE_ARGS + DESIRED_STATE_ARGS)}
return func(**kwargs)

return _decorator
Expand Down

0 comments on commit e12aae3

Please sign in to comment.