Skip to content

Commit 2baf82e

Browse files
committed
fix: preserve update behavior in dAuth staging
1 parent a65da9d commit 2baf82e

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

extensions/business/deeploy/deeploy_manager_api.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -871,15 +871,6 @@ def _process_pipeline_request(
871871
inputs.target_nodes = deployment_targets
872872
inputs[DEEPLOY_KEYS.TARGET_NODES_COUNT] = len(deployment_targets)
873873
inputs.target_nodes_count = len(deployment_targets)
874-
# Ensure plugin IDs are preserved for existing instances before any destructive action.
875-
self._ensure_plugin_instance_ids(
876-
inputs,
877-
discovered_plugin_instances=discovered_plugin_instances,
878-
owner=auth_result[DEEPLOY_KEYS.ESCROW_OWNER],
879-
app_id=app_id,
880-
job_id=job_id,
881-
)
882-
883874
if deeploy_specs_for_update is not None and not isinstance(deeploy_specs_for_update, dict):
884875
msg = (
885876
f"{DEEPLOY_ERRORS.REQUEST3}. Unexpected 'deeploy_specs' payload type "

extensions/business/deeploy/tests/test_update_requests.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,14 @@ def chainstore_hset(hkey, key, value):
9191

9292
plugin.chainstore_hset = chainstore_hset
9393

94-
called = {"delete": 0, "deploy": 0, "deploy_kwargs": None, "queued": 0, "bc_update": 0}
94+
called = {
95+
"delete": 0,
96+
"deploy": 0,
97+
"deploy_kwargs": None,
98+
"queued": 0,
99+
"bc_update": 0,
100+
"stage": 0,
101+
}
95102
plugin.bc = types.SimpleNamespace(
96103
node_addr_to_eth_addr=lambda node: node,
97104
submit_node_update=lambda **kwargs: called.__setitem__("bc_update", called["bc_update"] + 1),
@@ -116,11 +123,15 @@ def build_pipeline_config(**kwargs):
116123

117124
plugin.cmdapi_build_pipeline_config = build_pipeline_config
118125
plugin._load_dauth_job_secret_bundle = lambda job_id: None
119-
plugin.stage_job_pipeline_and_secrets = lambda pipeline, job_id, secret_bundle: {
120-
"job_id": str(job_id),
121-
"pipeline": copy.deepcopy(pipeline),
122-
"secret_bundle": copy.deepcopy(secret_bundle),
123-
}
126+
def stage_job_pipeline_and_secrets(pipeline, job_id, secret_bundle):
127+
called["stage"] += 1
128+
return {
129+
"job_id": str(job_id),
130+
"pipeline": copy.deepcopy(pipeline),
131+
"secret_bundle": copy.deepcopy(secret_bundle),
132+
}
133+
134+
plugin.stage_job_pipeline_and_secrets = stage_job_pipeline_and_secrets
124135
plugin.commit_staged_job_pipeline_and_secrets = lambda state: True
125136
plugin.rollback_staged_job_pipeline_and_secrets = lambda state: True
126137
plugin.delete_pipeline_from_nodes = lambda **kwargs: called.__setitem__("delete", called["delete"] + 1)
@@ -1709,7 +1720,8 @@ def test_process_update_uses_persisted_pipeline_when_all_old_nodes_are_offline(s
17091720
self.assertEqual(response[DEEPLOY_KEYS.STATUS], DEEPLOY_STATUS.COMMAND_DELIVERED)
17101721
self.assertEqual(called["delete"], 0)
17111722
self.assertEqual(called["deploy"], 1)
1712-
self.assertEqual(called["queued"], 1)
1723+
self.assertEqual(called["stage"], 1)
1724+
self.assertEqual(called["queued"], 0)
17131725
self.assertEqual(called["bc_update"], 1)
17141726
self.assertEqual(called["deploy_kwargs"]["new_nodes"], ["new-node-1"])
17151727
redeploy_plugins = called["deploy_kwargs"]["inputs"][DEEPLOY_KEYS.PLUGINS]

0 commit comments

Comments
 (0)