Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-14948

cannot update the repository writePolicy from groovy

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 3.6.0, 3.6.1
    • Fix Version/s: None
    • Component/s: Scripting
    • Labels:
      None

      Description

       
      I'm trying to update a repository writePolicy from groovy to ALLOW_ONCE using the following code, but after restarting nexus, the writePolicy is reset back to the default value of ALLOW. It seems the in-memory changes are not persisted on disk. Or maybe this is not the right way to change the writePolicy.

      import groovy.json.JsonOutput
      import org.sonatype.nexus.repository.storage.WritePolicy
      r = repository.repositoryManager.get("nuget-hosted")
      r.stop()
      r.configuration.attributes.storage.writePolicy = WritePolicy.ALLOW_ONCE
      r.update(r.configuration)
      r.start()
      
      return JsonOutput.toJson([
      configuration: r.configuration.attributes,
      writePolicy: r.configuration.attributes.storage.writePolicy,
      ])
      

       
      I've originally wrote about this at https://groups.google.com/a/glists.sonatype.com/forum/#!topic/nexus-users/6BszuArYf-I and it seems Danny is also affected by this at https://groups.google.com/a/glists.sonatype.com/d/msg/nexus-users/UJL3JjUwb3g/p79yWhAqAgAJ
       
       
       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rgl Rui Lopes
            Last Updated By:
            Peter Lynch Peter Lynch
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title