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

Properties are not created within the directory creation which causes beforeDirectoryReplication to not replicate folders in certain condition



    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 6.8.4
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Severity:


      Problem statement and Impact:
      When creating a new directory and specifying specific property at the creation command, it seems like if we have an event based replication and beforeDirectoryReplication block in a user plugin where this block triggers the replication only if we have this specific property on the folder, the property is not yet attached to the directory when calling the beforeDirectoryReplication block which causes the folder to not get replicated.

      Steps to reproduce:

      1. Configure event based replication for a local repo.
      2. Configure the below user plugin:

      import com.google.common.collect.HashMultimap
      import com.google.common.collect.SetMultimap
      import org.artifactory.repo.RepoPath
      replication {
       beforeDirectoryReplication { localRepoPath ->
              SetMultimap<String, String> props = HashMultimap.create()
              props.put("foo", "true")
              List<RepoPath> found = searches.itemsByProperties(props,localRepoPath.getRepoKey())
              log.info("Found items with property - " + found.toString())
              if (found.contains(localRepoPath)) {
                  log.info("Replicating folder: ${localRepoPath.getPath()} as it has" +
                           " the right property")
                  skip = false
              } else {
                  log.info("Skipping replication of a folder:" +
                           " ${localRepoPath.getPath()} as it does not have the" +
                           " right property")
                  skip = true

      This user plugin will trigger folder replication only if we have the foo=true property.

      3. Create a folder with the "foo=true" property

      curl -XPUT -u admin:password "http://localhost:8081/artifactory/generic-local/test-folder/;foo=true"

      You will notice that the folder has not been replicated and that it has been skipped, printing via the plugin the folders that have the property we get no results.

      2019-03-24 15:17:23,750 [http-nio-8081-exec-4] [INFO ] (o.a.e.UploadServiceImpl:240) - MKDir request to 'generic-local:test-folder'
      *2019-03-24 15:17:23,755 [http-nio-8081-exec-4] [INFO ] (replication         :26) - Found items with property - []*
      *2019-03-24 15:17:23,756 [http-nio-8081-exec-4] [INFO ] (replication         :33) - Skipping replication of a folder: test-folder as it does not have the right property*

      4. Create one more folder with the "foo=true" property:

      curl -XPUT -u admin:password "http://localhost:8081/artifactory/generic-local/test-folder-2/;foo=true" 

      We will skip again the replication of the new created folder, but now we will see that the previous directory from the previous creation command is in the list of the folders that have the property:

      2019-03-24 15:17:35,103 [http-nio-8081-exec-9] [INFO ] (o.a.e.UploadServiceImpl:240) - MKDir request to 'generic-local:test-folder-2'
      *2019-03-24 15:17:35,107 [http-nio-8081-exec-9] [INFO ] (replication         :26) - Found items with property - [generic-local:test-folder]*
      2019-03-24 15:17:35,108 [http-nio-8081-exec-9] [INFO ] (replication         :33) - Skipping replication of a folder: test-folder-2 as it does not have the right property

      Actual results:

      beforeDirectoryReplication is triggered before the property is attached to the directory. while the property has been mentioned in the directory creation command.

      Expected results:
      beforeDirectoryReplication should be triggered only after the property is attached to the directory. We mention in the wiki:


      Description: Create new directory at the specified destination.
      Notes: You can also attach properties as part of creating directories.


      Run the replication manually again or wait until the cron expression is triggering the replication again.




              mohammadt Mohammad Tibi
              1 Vote for this issue
              2 Start watching this issue



                  Sync Status

                  Connection: RTFACT Sync
                  RTMID-18836 -
                  • Last Sync Date: