How can I run RPM repository metadata calculation manually when ‘Auto Calculate RPM Metadata’ is enabled

Pradnya Shinde
2019-04-13 01:26

Summary

How can I run RPM repository metadata calculation manually when 'Auto Calculate RPM Metadata' is enabled

Affected Versions

Any version

Details

Requirement:

When 'Auto Calculate RPM Metadata is enabled for an RPM repository in Artifactory we need to be able to recalculate index manually as and when needed to ensure that the index is calculated and RPMs are ready to install. 

Resolution

To achieve this requirement:

1)

If you prefer to enable ‘Auto Calculate RPM Metadata’ and still want to be able to invoke the manual metadata calculation from command line then you can do so by using this REST API(use async=1). Refer to this documentation.

For example(note: async=1):

curl -uadmin:<password> -XPOST "localhost:8081/artifactory/api/yum/rpm-local?async=1" -i -Lvv

Note, this will give you a response 202(Accepted) as this is an Asynchronous request to calculate the metadata.

2)

If you want to perform a manual "Sync" metadata calculation then it can be used only when the “Auto Calculate RPM Metadata” is set to off.

With the manual "Sync" metadata calculation you can control the triggering of the yum metadata calculation manually. This can be used if you want to ensure all of the metadata on the repository is available to be served to any requesting client by holding the request until the calculation is finished.

Example of Sync api(note: async=0):

curl -uadmin:<password> -XPOST "localhost:8081/artifactory/api/yum/rpm-local?async=0" -i -Lvv

Note, this will give you a response 200(OK) as this is a Synchronous request to calculate the metadata.

3)

Having said that, with “Auto Calculate RPM Metadata” enabled, RPM metadata calculation is automatically triggered by the actions described in this documentation. So you can be assured that this setting will do the metadata calculation for you when enabled(and repeating the calculation with manual is not needed).

Automatic

RPM metadata is automatically calculated:

  1. When deploying/removing/copying/moving an RPM file.
  2. When performing content import (both system and repository imports).

Manual 

You can manually invoke RPM metadata calculation:

  1. By selecting the local repository in the Tree Browser and clicking Recalculate Index in the Actions menu.
  2. Via Artifactory's REST-API.