How can I run RPM repository metadata calculation manually when 'Auto Calculate RPM Metadata' is enabled
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.
To achieve this requirement:
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.
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.
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).
RPM metadata is automatically calculated:
- When deploying/removing/copying/moving an RPM file.
- When performing content import (both system and repository imports).
You can manually invoke RPM metadata calculation:
- By selecting the local repository in the Tree Browser and clicking Recalculate Index in the Actions menu.
- Via Artifactory's REST-API.