0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-29 18:21: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:
acceptance:
if: github.repository_owner == 'bpg'
strategy:
fail-fast: false
matrix:

View File

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

View File

@ -9,7 +9,6 @@ package apt
import (
"context"
"fmt"
"path/filepath"
"strconv"
"strings"
@ -179,7 +178,7 @@ func (r *resourceRepo) ImportState(
rp.Node = types.StringValue(parts[0])
if !filepath.IsAbs(parts[1]) {
if !strings.HasPrefix(parts[1], "/") {
resp.Diagnostics.AddError(
"Invalid resource ID",
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
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/.
*/
* 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
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package validators
import (
"fmt"
"path/filepath"
"regexp"
"strings"
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
@ -19,7 +19,7 @@ import (
func AbsoluteFilePathValidator() validator.String {
return NewParseValidator(
func(s string) (string, error) {
if filepath.IsAbs(s) {
if strings.HasPrefix(s, "/") {
return s, nil
}