Uploaded image for project: 'Artifactory Binary Repository'
  1. Artifactory Binary Repository
  2. RTFACT-20331

Using "Set Repository Replication Configuration" with one configuration in payload not overriding the replication key.

    Details

    • Type: Bug
    • Status: Open
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: 6.12.2, 6.13.1
    • Fix Version/s: None
    • Component/s: REST API
    • Labels:
      None

      Description

      Using Set Repository Replication Configuration with one configuration in payload not overriding the replication key, therefore a replication configuration is saved in the config descriptor with wrong replication key, this situation can cause for some issues, for example:

      When using the Set Repository Replication Configuration rest call and in the json payload we set a URL of old replication target URL, duplicate replication key is saved in the config descriptor and it not possible to make any change in Artifactory unless we manually remove the replication configuration.

      The issue will occur only if we will use the REST call mention above and the payload will include one replication setting.

      Steps to reproduce:
      1. create repository with the name "generic-local".
      2. Execute the following REST calls in the order below:

      REST #1:
      curl -k -H "Content-Type: application/json" -u admin:password -X PUT http://localhost:8081/artifactory/api/replications/generic-local -d "

      { \"url\" : \"http://url1/artifactory/abc\", \"socketTimeoutMillis\" : 15000, \"username\" : \"testuser\", \"password\" : \"password\", \"syncStatistics\" : false, \"enabled\" : true, \"cronExp\" : \"0 1 * ? * *\", \"syncDeletes\" : false, \"syncProperties\" : false, \"repoKey\" : \"generic-local\", \"enableEventReplication\" : true, \"checkBinaryExistenceInFilestore\" : false }

      "

      REST #2:
      curl -k -H "Content-Type: application/json" -u admin:password -X PUT http://localhost:8081/artifactory/api/replications/generic-local -d "

      { \"url\" : \"http://url2/artifactory/abc\", \"socketTimeoutMillis\" : 15000, \"username\" : \"testuser\", \"password\" : \"password\", \"syncStatistics\" : false, \"enabled\" : true, \"cronExp\" : \"0 1 * ? * *\", \"syncDeletes\" : false, \"syncProperties\" : false, \"repoKey\" : \"generic-local\", \"enableEventReplication\" : true, \"checkBinaryExistenceInFilestore\" : false }

      "

      After executing REST #2, the configuration of REST#1 will be overwritten by REST#2 but the same replication key will be saved.

      REST #3:
      curl -k -H "Content-Type: application/json" -u admin:password -X PUT http://localhost:8081/artifactory/api/replications/generic-local -d "[

      { \"url\" : \"http://url1/artifactory/abc\", \"socketTimeoutMillis\" : 15000, \"username\" : \"testuser\", \"password\" : \"password\", \"syncStatistics\" : false, \"enabled\" : true, \"cronExp\" : \"0 1 * ? * *\", \"syncDeletes\" : false, \"syncProperties\" : false, \"repoKey\" : \"generic-local\", \"enableEventReplication\" : true, \"checkBinaryExistenceInFilestore\" : false }

      ,

      { \"url\" : \"http://url3/artifactory/abc\", \"socketTimeoutMillis\" : 15000, \"username\" : \"testuser\", \"password\" : \"REDACTED\", \"syncStatistics\" : false, \"enabled\" : true, \"cronExp\" : \"0 1 * ? * *\", \"syncDeletes\" : false, \"syncProperties\" : false, \"repoKey\" : \"generic-local\", \"enableEventReplication\" : true, \"checkBinaryExistenceInFilestore\" : false }

      ]"

      3. You will recieve the following error:

      {
        "errors" : [ {
          "status" : 500,
          "message" : "Could not merge and save new descriptor [org.jfrog.common.ExecutionFailed: Last retry failed: code exception. Not trying again (Failed to reload configuration: Duplicate key generic-local_http__50ddf24258 (attempted merging values LocalReplication[generic-local|http://url2/artifactory/abc|generic-local_http__50ddf24258] and LocalReplication[generic-local|http://url1/artifactory/abc|generic-local_http__50ddf24258]))]"
        } ]
      }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yehudah Yehuda Hadad
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: