working but work in progress for templating
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 5m25s

This commit is contained in:
2025-07-29 22:36:50 +00:00
parent 91c4928ec7
commit 6f06f7d657
+16 -3
View File
@@ -22,16 +22,29 @@ def form(request):
def handle_survey_form(request): def handle_survey_form(request):
config.load_kube_config(config_file='/kubeconfig/config') config.load_kube_config(config_file='/kubeconfig/config')
v1 = client.BatchV1Api() v1 = client.BatchV1Api()
name = request.GET.get('name') name = request.GET.get('name')
url = request.GET.get('url') url = request.GET.get('url')
environment = Environment(loader=FileSystemLoader("django_code/stash_management/templates/")) environment = Environment(loader=FileSystemLoader("django_code/stash_management/templates/"))
template = environment.get_template("template.stash-pornpics-dowloader.job.yml") template = environment.get_template("template.stash-pornpics-dowloader.job.json")
template = environment.get_template("template.stash-pornpics-dowloader.job.yaml")
pod_manifest_job = template.render(name=name, url=url) pod_manifest_job = template.render(name=name, url=url)
#filepath_manifest_path="django_code/stash_management/templates/template.stash-pornpics-dowloader.job.yaml"
#filepath_manifest = open(filepath_manifest_path)
with open('django_code/stash_management/templates/template.stash-pornpics-dowloader.job.yaml', 'r') as file:
prime_service = yaml.safe_load(file)
#api_response = v1.create_namespaced_job(body=pod_manifest_job,namespace='stash')
api_response = v1.create_namespaced_job(body=prime_service,namespace='stash')
#return HttpResponse(pod_manifest_job)
api_response = v1.create_namespaced_job(body=pod_manifest_job,namespace='stash')
return HttpResponse(api_response) return HttpResponse(api_response)