-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
48 lines (48 loc) · 1.76 KB
/
script.py
File metadata and controls
48 lines (48 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from job_templates.models import ProjectJobTemplates
import logging
LOGGER = logging.getLogger('django')
def fixing_job_templates():
steps= [
{
"order": 0,
"step_name": "pre hook",
"is_conditional_step": False,
"step_code": "PRE_HOOKS",
"environment_variables": None
},
{
"order": 1,
"step_code": "DEPLOYMENT_MANIFEST_CREATOR",
"step_name": "Deployment Manifest Creator",
"is_conditional_step": False,
"environment_variables": None
}, {
"order": 2,
"step_code": "K8S_DEPLOYMENT_MANIFEST_APPLY",
"step_name": "K8s deployment manifest apply",
"is_conditional_step": False,
"environment_variables": None
},
{
"order": 3,
"step_name": "post hook",
"is_conditional_step": False,
"step_code": "POST_HOOKS",
"environment_variables": None
}]
steps_old = [{'order': 0, 'step_code': 'K8S_MANIFEST_APPLY',
'step_name': 'k8 deploy',
'is_conditional_step': False
, 'environment_variables': None}]
objects=ProjectJobTemplates.objects.all()
for obj in objects:
# i.job_template=default_v2_template
for jobs in obj.job_template['jobs']:
if jobs['job_code']=='deploy_job':
print(jobs["steps"])
if jobs["steps"] == steps_old:
jobs["steps"] = steps
# jobs.pop('steps')
# jobs['steps']=steps
obj.save()
fixing_job_templates()