diff --git a/cray/modules/bos/cli.py b/cray/modules/bos/cli.py index 3c51f49..61a07bf 100644 --- a/cray/modules/bos/cli.py +++ b/cray/modules/bos/cli.py @@ -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 @@ -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): @@ -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": "", @@ -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