Skip to content

Commit d56b880

Browse files
committed
Merge branch 'main' into add-eclair
* main: Fix Python 3.9 compatibility: replace match statement with if/elif admin scenarios access logs
2 parents 3238e64 + db5f124 commit d56b880

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

resources/charts/commander/templates/rbac.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ metadata:
4444
app.kubernetes.io/name: {{ .Chart.Name }}
4545
rules:
4646
- apiGroups: [""]
47-
resources: ["pods", "namespaces", "configmaps"]
47+
resources: ["pods", "namespaces", "configmaps", "pods/log"]
4848
verbs: ["get", "list", "watch"]
4949
---
5050
apiVersion: rbac.authorization.k8s.io/v1

test/data/plugins/hello/plugin.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,23 @@ def _entrypoint(ctx, plugin_content: dict, warnet_content: dict):
9191
"""Called by entrypoint"""
9292
hook_value = warnet_content[WarnetContent.HOOK_VALUE.value]
9393

94-
match hook_value:
95-
case (
96-
HookValue.PRE_NETWORK
97-
| HookValue.POST_NETWORK
98-
| HookValue.PRE_DEPLOY
99-
| HookValue.POST_DEPLOY
100-
):
101-
data = get_data(plugin_content)
102-
if data:
103-
_launch_pod(ctx, install_name=hook_value.value.lower() + "-hello", **data)
104-
else:
105-
_launch_pod(ctx, install_name=hook_value.value.lower() + "-hello")
106-
case HookValue.PRE_NODE:
107-
name = warnet_content[PLUGIN_ANNEX][AnnexMember.NODE_NAME.value] + "-pre-hello-pod"
108-
_launch_pod(ctx, install_name=hook_value.value.lower() + "-" + name, podName=name)
109-
case HookValue.POST_NODE:
110-
name = warnet_content[PLUGIN_ANNEX][AnnexMember.NODE_NAME.value] + "-post-hello-pod"
111-
_launch_pod(ctx, install_name=hook_value.value.lower() + "-" + name, podName=name)
94+
if hook_value in (
95+
HookValue.PRE_NETWORK,
96+
HookValue.POST_NETWORK,
97+
HookValue.PRE_DEPLOY,
98+
HookValue.POST_DEPLOY,
99+
):
100+
data = get_data(plugin_content)
101+
if data:
102+
_launch_pod(ctx, install_name=hook_value.value.lower() + "-hello", **data)
103+
else:
104+
_launch_pod(ctx, install_name=hook_value.value.lower() + "-hello")
105+
elif hook_value == HookValue.PRE_NODE:
106+
name = warnet_content[PLUGIN_ANNEX][AnnexMember.NODE_NAME.value] + "-pre-hello-pod"
107+
_launch_pod(ctx, install_name=hook_value.value.lower() + "-" + name, podName=name)
108+
elif hook_value == HookValue.POST_NODE:
109+
name = warnet_content[PLUGIN_ANNEX][AnnexMember.NODE_NAME.value] + "-post-hello-pod"
110+
_launch_pod(ctx, install_name=hook_value.value.lower() + "-" + name, podName=name)
112111

113112

114113
def get_data(plugin_content: dict) -> Optional[dict]:

0 commit comments

Comments
 (0)