Skip to content

Commit d7f9b59

Browse files
committed
fix: Set showunique on the call to GetTemplateID so we get a unique response from the CS API
This is a workaround for the fact that the CloudStack API returns an invalid count when calling listTemplates with domain level API creds.
1 parent 301314e commit d7f9b59

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/cloud/instance.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,15 @@ func (c *client) ResolveTemplate(
137137
}
138138
return csMachine.Spec.Template.ID, nil
139139
}
140-
templateID, count, err := c.cs.Template.GetTemplateID(csMachine.Spec.Template.Name, "executable", zoneID)
140+
templateID, count, err := c.cs.Template.GetTemplateID(csMachine.Spec.Template.Name, "executable", zoneID, func(cs *cloudstack.CloudStackClient, i interface{}) error {
141+
v, ok := i.(*cloudstack.ListTemplatesParams)
142+
if !ok {
143+
return fmt.Errorf("expected a cloudstack.ListTemplatesParams but got a %T", i)
144+
}
145+
v.SetShowunique(true)
146+
147+
return nil
148+
})
141149
if err != nil {
142150
c.customMetrics.EvaluateErrorAndIncrementAcsReconciliationErrorCounter(err)
143151
return "", multierror.Append(retErr, errors.Wrapf(

0 commit comments

Comments
 (0)