Skip to content

Commit

Permalink
#293 manage deletion if resource already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Apr 3, 2023
1 parent 81b1c5c commit f21d695
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions inst/actions/geonode4R_publish_ogc_services.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ function(action, entity, config){
#layername/sourcename
layername <- if(!is.null(data_object$layername)) data_object$layername else entity$identifiers$id

#check if resources already exists
#-------------------------------------------------------------------------------------------------
resource = GEONODE$getResourceByUUID(uuid = entity$identifiers$id)
if(!is.null(resource)){
config$logger.warn(sprintf("Resource '%s' (id = %s) already exists! Deleting it...", resource$uuid, resource$pk))
deleted = GEONODE$deleteResource(id = resource$pk)
if(deleted) config$logger.warn(sprintf("Resource '%s' (id = %s) deleted!", resource$uuid, resource$pk))
}

#upload
#-------------------------------------------------------------------------------------------------
if(data_object$upload){
Expand Down

0 comments on commit f21d695

Please sign in to comment.