--To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/5bfbbd86-1b0a-43ee-95bc-341c457df466%40glists.sonatype.com.
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
Suggested commit helped in deleting a repository. But can we pass the repository name dynamically, instead of hard coding in groovy (for creation and deletion, how do i pass the names through url). If yes, please let me know the ways of doing it.
Hello Rich,
I am able to write the groovy as you suggested. Currently I am writing the below and saving the file as Json “createRAW.json”:
“{
"name": "createRAW",
"type": "groovy",
"content": "repository.createRawHosted('private','Main')"
}”
Executing the curl POST command to the NXRM URL as below:
curl -X POST -u admin: xxxxxx --header "Content-Type: application/json" "http://localhost:8081/service/siesta/rest/v1/script" -d @"C:\createRAW.json"
Then I am able to execute the script with another curl command:
curl -X POST -u admin: xxxxxx --header "Content-Type: text/plain" http://localhost:8081/service/siesta/rest/v1/script/createRAW/run
With this I am able to create Raw Hosted repository in the NXRM with the name “Private”. But now my requirement is to pass the repository name dynamically to the URL instead of hard coding the JSON file. So please let me know the way to do it.
Also let me know if there is any other easier way of creating the repository, instead of the above process which I am following now.
Thanks in advance.
Regards,
Niharika.
--
You received this message because you are subscribed to a topic in the Google Groups "Nexus Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/a/glists.sonatype.com/d/topic/nexus-users/fB245hjTLNg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
nexus-users...@glists.sonatype.com.
To post to this group, send email to
nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/82a595cc-aa56-4a57-bdab-30e5ed88d189%40glists.sonatype.com.
Hello Rich,
I am able to write the groovy as you suggested. Currently I am writing the below and saving the file as Json “createRAW.json”:
“{
"name": "createRAW",
"type": "groovy",
"content": "repository.createRawHosted('private','Main')"
}”
Executing the curl POST command to the NXRM URL as below:
curl -X POST -u admin: xxxxxx --header "Content-Type: application/json" "http://localhost:8081/service/siesta/rest/v1/script" -d @"C:\createRAW.json"
Then I am able to execute the script with another curl command:
curl -X POST -u admin: xxxxxx --header "Content-Type: text/plain" http://localhost:8081/service/siesta/rest/v1/script/createRAW/run
With this I am able to create Raw Hosted repository in the NXRM with the name “Private”. But now my requirement is to pass the repository name dynamically to the URL instead of hard coding the JSON file. So please let me know the way to do it.
Also let me know if there is any other easier way of creating the repository, instead of the above process which I am following now.
Thanks in advance.
Regards,
Niharika.
From: Rich Seddon [mailto:rse...@sonatype.com]
Sent: 06 December 2017 08:36 PM
To: Nexus Users <nexus...@glists.sonatype.com>
Subject: Re: How to create or delete a repository in Nexus 3.2 OSS from command prompt
You can write a groovy script which does these things, and execute it from the REST API interface:
Rich
On Wednesday, December 6, 2017 at 3:26:36 AM UTC-6, nSarabu wrote:Hi All,
New user of Nexus, started using the Nexus OSS 3.2. Now i would like to create or delete a repository outside the Nexus UI, from command line.
Any help would be appreciated.
Regards,
nSarabu
--
You received this message because you are subscribed to a topic in the Google Groups "Nexus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/a/glists.sonatype.com/d/topic/nexus-users/fB245hjTLNg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/82a595cc-aa56-4a57-bdab-30e5ed88d189%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/DM5PR14MB1129ABE3F32CC068C093770785350%40DM5PR14MB1129.namprd14.prod.outlook.com.
I could pass the single variable using -d as in below:
{
"name": "createRAW",
"type": "groovy",
"content": "repository.createRawHosted(args)"
}
And in the curl to run script passing parameter -d “Test”. This is creating a repo with the name Test in the default blob store, but I wanted to create a repository with the dynamic values of all the below mentioned parameters in the signature of the method.
repository.createMavenHosted("private", BlobStoreManager.DEFAULT_BLOBSTORE_NAME, VersionPolicy.RELEASE, WritePolicy.ALLOW_ONCE, LayoutPolicy.STRICT)
Help me figuring out the Json file needs to be create with all dynamic values from the URL parameters. Give me Sample file and command format if possible for the above scenario. Also with all variable values that can be passed to each argument in the createRawHosted() method.
(Example: WritePolicy.ALLOW_ONCE, what is the value that I need to pass for Allow-redeploy in the UI)
Regards,
Niharika.
To unsubscribe from this group and all its topics, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/82a595cc-aa56-4a57-bdab-30e5ed88d189%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/DM5PR14MB1129ABE3F32CC068C093770785350%40DM5PR14MB1129.namprd14.prod.outlook.com.