fix the syntax error
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 27s

This commit is contained in:
Pierre Geeraert
2025-06-02 10:58:21 +01:00
parent c9d6d77931
commit 39e6a69a08
+9 -8
View File
@@ -111,15 +111,16 @@ def backup_job(request):
#help with yaml import
#https://github.com/kubernetes-client/python/issues/589
def backup_job_yaml(request):
def backup_job_yaml(request,sync_target):
config.load_kube_config(config_file='/code/kubeconfig')
v1 = client.BatchV1Api()
with urllib.request.urlopen(https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/pod.yaml") as manifest_url:
yaml_location = {
"synology" : "https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/synology_pod.yaml",
"openmediavault":"https://gitea.tryton.geeraert.eu/pi-ux-ce/Backup_kube/raw/branch/main/Infrequent_access/openmediavault_pod.yaml"
}
print(yaml_location[sync_target])
url_to_select=yaml_location[sync_target]
api_response = v1.create_namespaced_job(body=pod_manifest_job)
# with open('/code/pod.yaml') as :
job = yaml.safe_load(manifest_url)
v1.create_namespaced_job(
job['metadata']['namespace'], job, pretty=True
)
return HttpResponse(job['metadata']['namespace'])
return HttpResponse(api_response)