0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-30 02:31:10 +00:00

fix(repo): fix source.list path validation on Windows (#1429)

Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
Pavel Boldyrev 2024-07-05 20:20:34 -04:00 committed by GitHub
parent 357f7c70a7
commit 6103e67ae9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 18 deletions

View File

@ -10,7 +10,6 @@ on:
jobs: jobs:
acceptance: acceptance:
if: github.repository_owner == 'bpg'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:

View File

@ -36,15 +36,8 @@ const (
testAccResourceStandardRepoHandle = "no-subscription" testAccResourceStandardRepoHandle = "no-subscription"
) )
func testAccRepoInit(t *testing.T) *test.Environment {
t.Helper()
t.Parallel()
return test.InitEnvironment(t)
}
func TestAccDataSourceRepo(t *testing.T) { func TestAccDataSourceRepo(t *testing.T) {
te := testAccRepoInit(t) te := test.InitEnvironment(t)
tests := []struct { tests := []struct {
name string name string
@ -213,7 +206,6 @@ func TestAccDataSourceStandardRepo(t *testing.T) {
// [Read]: https://developer.hashicorp.com/terraform/plugin/framework/resources/read // [Read]: https://developer.hashicorp.com/terraform/plugin/framework/resources/read
// [Update]: https://developer.hashicorp.com/terraform/plugin/framework/resources/update // [Update]: https://developer.hashicorp.com/terraform/plugin/framework/resources/update
func TestAccResourceRepoValidInput(t *testing.T) { func TestAccResourceRepoValidInput(t *testing.T) {
t.Helper()
t.Parallel() t.Parallel()
te := test.InitEnvironment(t) te := test.InitEnvironment(t)

View File

@ -9,7 +9,6 @@ package apt
import ( import (
"context" "context"
"fmt" "fmt"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
@ -179,7 +178,7 @@ func (r *resourceRepo) ImportState(
rp.Node = types.StringValue(parts[0]) rp.Node = types.StringValue(parts[0])
if !filepath.IsAbs(parts[1]) { if !strings.HasPrefix(parts[1], "/") {
resp.Diagnostics.AddError( resp.Diagnostics.AddError(
"Invalid resource ID", "Invalid resource ID",
fmt.Sprintf("given source list file path %q is not an absolute path: %s", parts[1], idFormatErrMsg), fmt.Sprintf("given source list file path %q is not an absolute path: %s", parts[1], idFormatErrMsg),

View File

@ -1,15 +1,15 @@
/* /*
This Source Code Form is subject to the terms of the Mozilla Public * This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/ */
package validators package validators
import ( import (
"fmt" "fmt"
"path/filepath"
"regexp" "regexp"
"strings"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/schema/validator"
@ -19,7 +19,7 @@ import (
func AbsoluteFilePathValidator() validator.String { func AbsoluteFilePathValidator() validator.String {
return NewParseValidator( return NewParseValidator(
func(s string) (string, error) { func(s string) (string, error) {
if filepath.IsAbs(s) { if strings.HasPrefix(s, "/") {
return s, nil return s, nil
} }