@@ -169,27 +169,17 @@ def appeal(self, *, decision_cinder_id, appeal_text, appealer):
169
169
else :
170
170
raise HTTPError (response .content )
171
171
172
- def _send_create_decision (
173
- self , url , data , action , reasoning , policy_uuids , * , success_code = 201
174
- ):
172
+ def _send_create_decision (self , url , data , action , reasoning , policy_uuids ):
175
173
data = {
176
174
** data ,
177
175
'reasoning' : self .get_str (reasoning ),
178
176
'policy_uuids' : policy_uuids ,
179
- ** (
180
- {
181
- 'enforcement_actions_slugs' : [action ],
182
- 'enforcement_actions_update_strategy' : 'set' ,
183
- }
184
- if action is not None
185
- else {}
186
- ),
177
+ 'enforcement_actions_slugs' : [action ],
178
+ 'enforcement_actions_update_strategy' : 'set' ,
187
179
}
188
180
response = requests .post (url , json = data , headers = self .get_cinder_http_headers ())
189
- if response .status_code == success_code :
190
- return response .json ().get ('uuid' )
191
- else :
192
- raise HTTPError (response .content )
181
+ response .raise_for_status ()
182
+ return response .json ().get ('uuid' )
193
183
194
184
def create_decision (self , * , action , reasoning , policy_uuids ):
195
185
if self .type is None :
@@ -208,12 +198,7 @@ def create_job_decision(self, *, action, reasoning, policy_uuids, job_id):
208
198
209
199
def create_override_decision (self , * , action , reasoning , policy_uuids , decision_id ):
210
200
url = f'{ settings .CINDER_SERVER_URL } decisions/{ decision_id } /override/'
211
- # TODO: send action too once
212
- # https://lindie.app/share/6a21d831b39351d7c6fe898f6d22619af62dde98/PLAT-1834
213
- # implements the same parameters for overrides
214
- return self ._send_create_decision (
215
- url , {}, None , reasoning , policy_uuids , success_code = 200
216
- )
201
+ return self ._send_create_decision (url , {}, action , reasoning , policy_uuids )
217
202
218
203
def close_job (self , * , job_id ):
219
204
url = f'{ settings .CINDER_SERVER_URL } jobs/{ job_id } /cancel'
0 commit comments