mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-01 11:02:59 +00:00
fix(file): spurious unsupported content type warning (#395)
This commit is contained in:
parent
e9a74e9037
commit
4da2b682de
@ -17,6 +17,7 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -404,13 +405,15 @@ func fileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag
|
|||||||
return diag.Errorf("failed to determine the datastore path")
|
return diag.Errorf("failed to determine the datastore path")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sort.Strings(datastore.Content)
|
||||||
|
|
||||||
_, found := slices.BinarySearch(datastore.Content, *contentType)
|
_, found := slices.BinarySearch(datastore.Content, *contentType)
|
||||||
if !found {
|
if !found {
|
||||||
diags = append(diags, diag.Diagnostics{
|
diags = append(diags, diag.Diagnostics{
|
||||||
diag.Diagnostic{
|
diag.Diagnostic{
|
||||||
Severity: diag.Warning,
|
Severity: diag.Warning,
|
||||||
Summary: fmt.Sprintf("the datastore %q does not support content type %q",
|
Summary: fmt.Sprintf("the datastore %q does not support content type %q; supported content types are: %v",
|
||||||
*datastore.Storage, *contentType,
|
*datastore.Storage, *contentType, datastore.Content,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
}...)
|
}...)
|
||||||
|
Loading…
Reference in New Issue
Block a user