@@ -1106,61 +1106,58 @@ def __processjiraticket( self, scanner: str, ticketsummary: str, ticket: cxresul
1106
1106
ticketkey = jiraticket .get ('key' )
1107
1107
current_status = jiraticket ['fields' ]['status' ]['name' ]
1108
1108
1109
- # >>> TEMP CONDITION TO REMOVE
1110
- if ticketkey in ['GINFOSEC-75333' , 'GINFOSEC-72118' , 'GINFOSEC-72120' ] :
1111
-
1112
- # If it's not opened, let's reopen it
1113
- if (str (current_status ).lower () in self .jiraparams .closedstatus ) :
1114
- if self .jiraparams .opentransition :
1115
- try :
1116
- retdata = self .jira .tickettransition ( ticketkey , self .jiraparams .opentransition )
1117
- except HTTPError as e :
1118
- raise Exception ( self .__processjiraexception ( False , False , e ) )
1119
- except Exception as e :
1120
- if str (e ) :
1121
- raise e
1122
- else :
1123
- raise Exception ( 'Error transitioning jira ticket' )
1124
-
1125
- reopened = True
1126
- else :
1127
- cxlogger .logwarning ( 'Open transtion missing. Cannot reopen "' + str (ticketkey ) + '"' )
1128
- # Check if description changed
1129
- newdescription = None
1130
- if description and (not description == jiraticket ['fields' ].get ('description' )) :
1131
- newdescription = description
1132
- # Check if priority changed
1133
- newpriority = None
1134
- ticketpriority = None
1135
- if jiraticket ['fields' ].get ('priority' ) :
1136
- ticketpriority = jiraticket ['fields' ]['priority' ].get ('name' )
1137
- if priority and (not priority == ticketpriority ) :
1138
- newpriority = priority
1139
- # Check if labels changed
1140
- newlabels = []
1141
- existinglabels = jiraticket ['fields' ].get ('labels' )
1142
- if not existinglabels :
1143
- existinglabels = []
1144
- for label in labels :
1145
- found = next ( filter ( lambda el : el == label , existinglabels ), None )
1146
- if not found :
1147
- newlabels .append (label )
1148
- if len (newlabels ) == 0 :
1149
- newlabels = None
1150
- # Check fields
1151
- if len (fields ) == 0 :
1152
- fields = None
1153
-
1154
- if newdescription or newpriority or newlabels or fields :
1109
+ # If it's not opened, let's reopen it
1110
+ if (str (current_status ).lower () in self .jiraparams .closedstatus ) :
1111
+ if self .jiraparams .opentransition :
1155
1112
try :
1156
- self .jira .projecteditissue ( ticketkey , newdescription , fields , newlabels , newpriority )
1113
+ retdata = self .jira .tickettransition ( ticketkey , self . jiraparams . opentransition )
1157
1114
except HTTPError as e :
1158
1115
raise Exception ( self .__processjiraexception ( False , False , e ) )
1159
1116
except Exception as e :
1160
1117
if str (e ) :
1161
1118
raise e
1162
1119
else :
1163
- raise Exception ( 'Error updating jira ticket' )
1120
+ raise Exception ( 'Error transitioning jira ticket' )
1121
+
1122
+ reopened = True
1123
+ else :
1124
+ cxlogger .logwarning ( 'Open transtion missing. Cannot reopen "' + str (ticketkey ) + '"' )
1125
+ # Check if description changed
1126
+ newdescription = None
1127
+ if description and (not description == jiraticket ['fields' ].get ('description' )) :
1128
+ newdescription = description
1129
+ # Check if priority changed
1130
+ newpriority = None
1131
+ ticketpriority = None
1132
+ if jiraticket ['fields' ].get ('priority' ) :
1133
+ ticketpriority = jiraticket ['fields' ]['priority' ].get ('name' )
1134
+ if priority and (not priority == ticketpriority ) :
1135
+ newpriority = priority
1136
+ # Check if labels changed
1137
+ newlabels = []
1138
+ existinglabels = jiraticket ['fields' ].get ('labels' )
1139
+ if not existinglabels :
1140
+ existinglabels = []
1141
+ for label in labels :
1142
+ found = next ( filter ( lambda el : el == label , existinglabels ), None )
1143
+ if not found :
1144
+ newlabels .append (label )
1145
+ if len (newlabels ) == 0 :
1146
+ newlabels = None
1147
+ # Check fields
1148
+ if len (fields ) == 0 :
1149
+ fields = None
1150
+
1151
+ if newdescription or newpriority or newlabels or fields :
1152
+ try :
1153
+ self .jira .projecteditissue ( ticketkey , newdescription , fields , newlabels , newpriority )
1154
+ except HTTPError as e :
1155
+ raise Exception ( self .__processjiraexception ( False , False , e ) )
1156
+ except Exception as e :
1157
+ if str (e ) :
1158
+ raise e
1159
+ else :
1160
+ raise Exception ( 'Error updating jira ticket' )
1164
1161
1165
1162
if reopened :
1166
1163
cxlogger .verbose ( '- JIRA issue ' + ticketkey + ' re-opened, type ' + scanner .upper () + ', prev status "' + current_status + '", with key "' + ticketsummary + '"' )
0 commit comments