Skip to content

Commit cc930c8

Browse files
Remove components setting for OBS tickets creation.
Also only set OBS Systems field if defined so JIRA is able to return a bad response in that case.
1 parent 42dae07 commit cc930c8

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

manager/manager/utils.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646
OBS_TIME_LOST_FIELD = "customfield_10106"
4747
OBS_SYSTEMS_FIELD = "customfield_10476"
4848

49-
# Using Unknown component for now
50-
# For a full list check:
51-
# https://rubinobs.atlassian.net/rest/api/latest/project/OBS/components
52-
OBS_DEFAULT_COMPONENT_ID = "11614"
53-
5449
DATETIME_ISO_FORMAT = "%Y-%m-%dT%H:%M:%S.%f"
5550

5651

@@ -422,11 +417,7 @@ def jira_ticket(request_data):
422417

423418
tags_data = request_data.get("tags").split(",") if request_data.get("tags") else []
424419

425-
obs_system_selection = (
426-
request_data.get("jira_obs_selection")
427-
if request_data.get("jira_obs_selection")
428-
else '{"selection": []}'
429-
)
420+
obs_system_selection = request_data.get("jira_obs_selection")
430421

431422
try:
432423
jira_payload = {
@@ -452,10 +443,10 @@ def jira_ticket(request_data):
452443
# else "off"
453444
# ),
454445
OBS_TIME_LOST_FIELD: float(request_data.get("time_lost", 0)),
455-
OBS_SYSTEMS_FIELD: json.loads(obs_system_selection),
456446
},
457-
"update": {"components": [{"set": [{"id": OBS_DEFAULT_COMPONENT_ID}]}]},
458447
}
448+
if obs_system_selection:
449+
jira_payload["fields"][OBS_SYSTEMS_FIELD] = json.loads(obs_system_selection)
459450
except Exception as e:
460451
return Response(
461452
{

0 commit comments

Comments
 (0)