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:
parent
357f7c70a7
commit
6103e67ae9
1
.github/workflows/testacc.yml
vendored
1
.github/workflows/testacc.yml
vendored
@ -10,7 +10,6 @@ on:
|
||||
|
||||
jobs:
|
||||
acceptance:
|
||||
if: github.repository_owner == 'bpg'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
|
@ -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)
|
||||
|
@ -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),
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user