Skip to content

Commit

Permalink
Merge pull request #228 from dwoolger/master
Browse files Browse the repository at this point in the history
Filter out talos images
  • Loading branch information
dippydocus authored Jan 9, 2025
2 parents 80081fe + 608a0cf commit 9bfd02e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion disk_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
2 changes: 1 addition & 1 deletion disk_image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 9bfd02e

Please sign in to comment.