From 608a0cff6242ea941a4a4ffd54b26215bd990237 Mon Sep 17 00:00:00 2001 From: "david.woolger@civo.com" Date: Wed, 8 Jan 2025 16:11:45 +0000 Subject: [PATCH] Filter out talos images --- disk_image.go | 2 +- disk_image_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/disk_image.go b/disk_image.go index 54bec45..9f30d3f 100644 --- a/disk_image.go +++ b/disk_image.go @@ -35,7 +35,7 @@ func (c *Client) ListDiskImages() ([]DiskImage, error) { filteredDiskImages := make([]DiskImage, 0) for _, diskImage := range diskImages { - if !strings.Contains(diskImage.Name, "k3s") { + if !strings.Contains(diskImage.Name, "k3s") && !strings.Contains(diskImage.Name, "talos") { filteredDiskImages = append(filteredDiskImages, diskImage) } } diff --git a/disk_image_test.go b/disk_image_test.go index 4f474bf..abdac23 100644 --- a/disk_image_test.go +++ b/disk_image_test.go @@ -57,7 +57,7 @@ func TestFindDiskImage(t *testing.T) { func TestListDiskImages(t *testing.T) { client, server, _ := NewClientForTesting(map[string]string{ - "/v2/disk_images": `[{"id":"ed8a0ad5-5fe3-4ec7-9864-d54c894b8841","name":"1.20.0-k3s1","version":"1.20.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"f3931c6d-066a-4210-8d33-d24fc43220ec","name":"1.20.0-k3s2","version":null,"state":"available","distribution":null,"description":null,"label":null},{"id":"ec0d4f71-068a-4226-b9a8-dab99c489eb6","name":"1.21.2-k3s1","version":"1.21.2-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"22552dcf-aea3-4403-ae62-93651932bbd7","name":"centos-7","version":"7","state":"available","distribution":"centos","description":null,"label":null},{"id":"4204229c-510c-4ba4-ab07-522e2aaa2cf8","name":"debian-10","version":"10","state":"available","distribution":"debian","description":null,"label":null},{"id":"cddce6c9-f84e-4e4f-ab8d-7a33cab85158","name":"debian-9","version":"9","state":"available","distribution":"debian","description":null,"label":null},{"id":"7149b763-92da-4f5c-b3fc-c2ad96d17922","name":"k3s-1-20","version":"1.20.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"8a2f1cc5-670c-454b-b914-0cffd81f070c","name":"k3s-1-21","version":"1.21.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"c3b28d45-c161-4abc-bdda-4facac38f2b1","name":"ubuntu-bionic","version":"18.04","state":"available","distribution":"ubuntu","description":null,"label":null},{"id":"8eb48e20-e5db-49fe-9cdf-cc8f381c61c6","name":"ubuntu-focal","version":"20.04","state":"available","distribution":"ubuntu","description":null,"label":null}]`, + "/v2/disk_images": `[{"id":"ed8a0ad5-5fe3-4ec7-9864-d54c894b8845","name":"talos-v1.5.0","version":"v1.5.0","state":"available","distribution":"talos","description":null,"label":null},{"id":"ed8a0ad5-5fe3-4ec7-9864-d54c894b8841","name":"1.20.0-k3s1","version":"1.20.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"f3931c6d-066a-4210-8d33-d24fc43220ec","name":"1.20.0-k3s2","version":null,"state":"available","distribution":null,"description":null,"label":null},{"id":"ec0d4f71-068a-4226-b9a8-dab99c489eb6","name":"1.21.2-k3s1","version":"1.21.2-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"22552dcf-aea3-4403-ae62-93651932bbd7","name":"centos-7","version":"7","state":"available","distribution":"centos","description":null,"label":null},{"id":"4204229c-510c-4ba4-ab07-522e2aaa2cf8","name":"debian-10","version":"10","state":"available","distribution":"debian","description":null,"label":null},{"id":"cddce6c9-f84e-4e4f-ab8d-7a33cab85158","name":"debian-9","version":"9","state":"available","distribution":"debian","description":null,"label":null},{"id":"7149b763-92da-4f5c-b3fc-c2ad96d17922","name":"k3s-1-20","version":"1.20.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"8a2f1cc5-670c-454b-b914-0cffd81f070c","name":"k3s-1-21","version":"1.21.0-k3s1","state":"available","distribution":"civo-k3s","description":null,"label":null},{"id":"c3b28d45-c161-4abc-bdda-4facac38f2b1","name":"ubuntu-bionic","version":"18.04","state":"available","distribution":"ubuntu","description":null,"label":null},{"id":"8eb48e20-e5db-49fe-9cdf-cc8f381c61c6","name":"ubuntu-focal","version":"20.04","state":"available","distribution":"ubuntu","description":null,"label":null}]`, }) defer server.Close() got, err := client.ListDiskImages()