Artifact management plugin
regenerate_host_artifact​
Regenerates a host artifact for a given task.
This function retrieves an artifact node associated with the given artifact name from the InfrahubNode, then sends a request to regenerate the artifact using the Infrahub API.
Parameters​
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
task | Task | Yes | The task instance containing host-related data. | |
artifact | str | Yes | The name of the artifact to regenerate. |
Examples​
Regenerate artifact for a given device​
from nornir import InitNornir
from nornir.core.plugins.inventory import InventoryPluginRegister
from nornir_infrahub.plugins.inventory.infrahub import InfrahubInventory
from nornir_infrahub.plugins.tasks import regenerate_host_artifact
from nornir_utils.plugins.functions import print_result
def main():
InventoryPluginRegister.register("InfrahubInventory", InfrahubInventory)
nr = InitNornir(inventory=...)
eos_devices = nr.filter(platform="eos")
# regenerate an artifact for a host
print_result(eos_devices.run(task=regenerate_host_artifact, artifact="startup-config"))
return 0
if __name__ == "__main__":
raise SystemExit(main())