-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from zeitounator/feat/enhancedRessourceCreation
Refactor and enhance nexus ressources creation through scripts
- Loading branch information
Showing
113 changed files
with
1,293 additions
and
2,136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import groovy.json.JsonOutput | ||
import groovy.json.JsonSlurper | ||
|
||
parsed_args = new JsonSlurper().parseText(args) | ||
|
||
List<Map<String, String>> actionDetails = [] | ||
Map scriptResults = [changed: false, error: false] | ||
scriptResults.put('action_details', actionDetails) | ||
|
||
parsed_args.each { blobstoreDef -> | ||
|
||
Map<String, String> currentResult = [name: blobstoreDef.name, type: blobstoreDef.get('type', 'file')] | ||
|
||
existingBlobStore = blobStore.getBlobStoreManager().get(blobstoreDef.name) | ||
if (existingBlobStore == null) { | ||
try { | ||
if (blobstoreDef.type == "S3") { | ||
blobStore.createS3BlobStore(blobstoreDef.name, blobstoreDef.config) | ||
msg = "S3 blobstore {} created" | ||
} else { | ||
blobStore.createFileBlobStore(blobstoreDef.name, blobstoreDef.path) | ||
msg = "File blobstore {} created" | ||
} | ||
log.info(msg, blobstoreDef.name) | ||
currentResult.put('status', 'created') | ||
scriptResults['changed'] = true | ||
} catch (Exception e) { | ||
log.error('Could not create blobstore {}: {}', blobstoreDef.name, e.toString()) | ||
currentResult.put('status', 'error') | ||
scriptResults['error'] = true | ||
currentResult.put('error_msg', e.toString()) | ||
} | ||
} else { | ||
msg = "Blobstore {} already exists. Left untouched" | ||
currentResult.put('status', 'exists') | ||
} | ||
|
||
log.info(msg, blobstoreDef.name) | ||
|
||
scriptResults['action_details'].add(currentResult) | ||
} | ||
|
||
return JsonOutput.toJson(scriptResults) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.