Skip to content
Snippets Groups Projects
Commit 2d5abe7a authored by Shane Hutchins's avatar Shane Hutchins
Browse files

Merge branch 'minor_fixes' into 'master'

minor enhancements

See merge request !285
parents cc213bae 44b3a0e8
No related branches found
No related tags found
3 merge requests!299Update Dev branch,!298Securityfix,!285minor enhancements
Pipeline #162091 failed
......@@ -124,8 +124,12 @@ async def delete_partition_policy(policy_id: str, data_partition: str, auth_data
"result": result.json
}
else:
logger.error(f"Error when talking to OPA {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to OPA {result.message}")
if cloud_provider == conf.LOCAL:
logger.error(f"Error when talking to OPA {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to OPA {result.message}")
else:
logger.error(f"Error when talking to bundle service {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to bundle service {result.message}")
@router.put("/policies/osdu/partition/{data_partition}/{policy_id}")
async def create_or_update_partition_policy(request: Request, policy_id: str, data_partition: str, file: UploadFile, auth_data: auth.Auth = Depends(auth.require_authorized_admin)):
......@@ -217,5 +221,9 @@ async def create_or_update_partition_policy(request: Request, policy_id: str, da
"status": result.ok,
"message": result.message}
else:
logger.error(f"Error when talking to CSP/OPA {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to OPA: {result.message}")
if cloud_provider == conf.LOCAL:
logger.error(f"Error when talking to OPA {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to OPA {result.message}")
else:
logger.error(f"Error when talking to bundle service {result.message}")
raise HTTPException(status_code=result.status_code, detail=f"Error when talking to bundle service {result.message}")
......@@ -92,6 +92,7 @@ def put_policy(data_partition, policy_id, policy):
except Exception as err:
logger.critical(f"Error Downloading {bundle} from CSP Storage: {err}")
response.status_code = HTTP_503_SERVICE_UNAVAILABLE
response.message = f"Unable to add policy {policy_id} to bundle server: download bundle {bundle} error: {err}"
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
message = template.format(type(err).__name__, err.args)
logger.critical(message)
......@@ -115,6 +116,7 @@ def put_policy(data_partition, policy_id, policy):
response.status_code = HTTP_202_ACCEPTED
return response
else:
response.message = f"Unable to add policy {policy_id} to bundle server: upload error {bundle}"
logger.critical(f"Error uploading {bundle} to CSP Storage")
return response
......
......@@ -44,7 +44,7 @@ def test_confirm_deletion_of_osdu_partition_policies_expect_not_found_service_ur
#pytest.skip("Skipping delete")
num_tests = 0
p = os.path.dirname(os.path.abspath(__file__))
delete_skip_list = ['dataauthz.rego', 'search.rego']
delete_skip_list = ['dataauthz.rego', 'search.rego', 'search2.rego']
template_datadir = os.path.join(p, '..', 'templates')
for filename in sorted(os.listdir(template_datadir)):
filetype='.rego'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment