Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions v1/providers/shadeform/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ func (c *ShadeformClient) ListInstances(ctx context.Context, _ v1.ListInstancesA
for _, instance := range resp.Instances {
singleInstance, err := c.convertShadeformInstanceToV1Instance(instance)
if err != nil {
return nil, errors.WrapAndTrace(err)
c.logger.Warn(ctx, "skipping instance without refID tag",
v1.LogField("instanceID", instance.Id),
v1.LogField("instanceName", instance.Name),
v1.LogField("error", err.Error()))
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we would want an warn or err log line here so we can track these?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, Prateek!
Added a warning log with instance ID, name, and error details to further track such instances.

}
instances = append(instances, *singleInstance)
}
Expand Down Expand Up @@ -357,13 +361,13 @@ func (c *ShadeformClient) convertShadeformInstanceToV1Instance(shadeformInstance

refID, found := tags[refIDTagName]
if !found {
return nil, errors.WrapAndTrace(errors.New("could not find refID tag"))
return nil, fmt.Errorf("instance missing refID tag: instanceID=%s, instanceName=%s", shadeformInstance.Id, shadeformInstance.Name)
}
delete(tags, refIDTagName)

cloudCredRefID, found := tags[cloudCredRefIDTagName]
if !found {
return nil, errors.WrapAndTrace(errors.New("could not find cloudCredRefID tag"))
return nil, fmt.Errorf("instance missing cloudCredRefID tag: instanceID=%s, instanceName=%s", shadeformInstance.Id, shadeformInstance.Name)
}
delete(tags, cloudCredRefIDTagName)

Expand Down
Loading