fix download api
@@ -267,12 +267,14 @@ func (b *bareMetalInventory) DeregisterCluster(ctx context.Context, params inven
}
func (b *bareMetalInventory) DownloadClusterISO(ctx context.Context, params inventory.DownloadClusterISOParams) middleware.Responder {
- var cluster *models.Cluster
- if err := b.db.First(cluster, "id = ?", params.ClusterID); err != nil {
+ logrus.Infof("prepare and download image for cluster %s", params.ClusterID)
+ var cluster models.Cluster
+ if err := b.db.First(&cluster, "id = ?", params.ClusterID).Error; err != nil {
+ logrus.WithError(err).Errorf("failed to get cluster %s", params.ClusterID)
return inventory.NewDownloadClusterISONotFound()
}
- if err := b.createImageJob(ctx, cluster); err != nil {
+ if err := b.createImageJob(ctx, &cluster); err != nil {
logrus.WithError(err).Error("failed to create image job")
return inventory.NewDownloadClusterISOInternalServerError()
}
