Commit Graph

158 Commits

Author SHA1 Message Date
Mitchell Hashimoto 2d9dd25493 config/module: fix regression of ignoring forced type if valid URL
/cc @ceh - Does this break Windows at all? This regressed with your
commit (we didn't have test coverage on it). I added a test now, though.
2015-02-01 20:17:56 +01:00
Emil Hessman 97227a5c70 config/module: fix detection of file paths on Windows
Absolute file paths were not correctly detected by module.Detect
when using url.Parse to parse the source URL. Wrap the detection
with urlParse to properly handle file path detections on Windows.

Fixes command test failures on Windows.
2015-01-28 10:40:32 +01:00
Emil Hessman 65177edd1e config/module: fix test failures on Windows
When parsing URLs on Windows, assume it is a drive letter path
if the second element is a ':' character. Format the drive letter
path as a "file:///"-path prior to parsing the URL.

Fixes test failures of the following form in command on Windows:

=== RUN TestApply_plan
--- FAIL: TestApply_plan (0.00s)
        apply_test.go:379: bad: 1

		module download not supported for scheme 'c'
2015-01-28 08:19:04 +01:00
Emil Hessman d5a49363d7 config/module: handle absolute file paths on Windows
Using url.Parse to parse an absolute file path on Windows yields
a URL type where the Path element is prefixed by a slash.

For example, parsing "file:///C:/Users/user" gives a URL type
with Path:"/C:/Users/user".

According to golang.org/issue/6027, the parsing is correct as is.

The leading slash on the Path must be eliminated before any file
operations.

This commit introduces a urlParse function which wraps the url.Parse
functionality and removes the leading slash in Path for absolute file
paths on Windows.

Fixes config/module test failures on Windows.
2015-01-27 23:18:47 +01:00
Emil Hessman 78d1fc742f config/module: adjust HttpGetter test to fix Windows test failure
Specify laddr on the form host:port in the call to net.Listen as
documented for net.Dial, see godoc.org/net#Dial

Fixes the following test failures on Windows:

> go test -run=TestHttpGetter
--- FAIL: TestHttpGetter_header (0.00s)
        get_http_test.go:31: err: Get http://[::]:52101/header?terraform-get=1: dial tcp [::]:52101: ConnectEx tcp: The requested address is not valid in its context.
--- FAIL: TestHttpGetter_meta (0.00s)
        get_http_test.go:55: err: Get http://[::]:52103/meta?terraform-get=1: dial tcp [::]:52103: ConnectEx tcp: The requested address is not valid in its context.
--- FAIL: TestHttpGetter_metaSubdir (0.00s)
        get_http_test.go:79: err: Get http://[::]:52105/meta-subdir?terraform-get=1: dial tcp [::]:52105: ConnectEx tcp: The requested address is not valid in its context.
FAIL
exit status 1
FAIL github.com/hashicorp/terraform/config/module    0.054s
2015-01-27 23:18:46 +01:00
Emil Hessman 74cf8fcabd config/module: adjust FileDetector tests for Windows
"/foo" is not an absolute path on Windows. Adjust the FileDetector
tests to take that into account when verifying the results.

Fixes FileDetector test failures on Windows.
2015-01-27 23:18:46 +01:00
Emil Hessman 160e4f926e config/module: fix panic on Windows when running tests
On Windows, Go returns paths with the `\` path separator.
Make sure we are using `/` even on Windows since URLs are `/`-based.
2015-01-27 07:52:51 +01:00
Seth Vargo 94e1eac051 Merge pull request #547 from ceh/issue-518
Fix issue 518
2014-11-20 13:30:14 -05:00
Emil Hessman a76290f278 config/module: don't walk dst when dst is in src
Fixes #518
2014-11-06 13:45:01 +01:00
Emil Hessman 4bfe18b40d argument and verb formatting fixes reported by go vet
builtin/providers/aws/tags_test.go:56: unrecognized printf verb 'i'
builtin/providers/aws/tags_test.go:59: unrecognized printf verb 'i'

config/config_test.go:101: possible formatting directive in Fatal call
config/config_test.go:157: possible formatting directive in Fatal call

config/module/get_file_test.go:91: missing argument for Fatalf(%s): format reads arg 1, have only 0 args

helper/schema/schema.go:341: arg v.Type for printf verb %s of wrong type: schema.ValueType
helper/schema/schema.go:656: missing argument for Errorf(%s): format reads arg 2, have only 1 args
helper/schema/schema.go:912: arg schema.Type for printf verb %s of wrong type: schema.ValueType

terraform/context.go:178: arg v.Type() for printf verb %s of wrong type: github.com/hashicorp/terraform/config.VariableType
terraform/context.go:486: arg c.Operation for printf verb %s of wrong type: terraform.walkOperation

terraform/diff_test.go💯 arg actual for printf verb %s of wrong type: terraform.DiffChangeType
terraform/diff_test.go:235: arg actual for printf verb %s of wrong type: terraform.DiffChangeType
2014-11-02 13:56:44 +01:00
Mitchell Hashimoto 369ba8cf07 config/module: fix issue where Get was copying subdir contents twice 2014-10-13 17:38:27 -07:00
Mitchell Hashimoto 6ee9c06cdc config/module: copyDir properly copies files in subdirectories 2014-10-12 21:12:42 -07:00
Mitchell Hashimoto 1e00b4386c config/module: Child(nil) or empty will return self 2014-10-07 20:02:18 -07:00
Mitchell Hashimoto 267d45df86 config/module: Can look up Child with Tree.Child 2014-10-07 20:00:36 -07:00
Mitchell Hashimoto 5c2182e316 config/module: only return SkipDir if it is dot-prefixed 2014-10-03 13:48:08 -07:00
Mitchell Hashimoto f35ebe7032 config/module: walk actually recurses into dirs, don't copy dot-prefix 2014-10-03 13:46:19 -07:00
Mitchell Hashimoto 3941dbac5d fmt 2014-09-28 11:51:49 -07:00
Mitchell Hashimoto 0a2d06268c config/module: detect supports subdirs 2014-09-27 09:29:12 -07:00
Mitchell Hashimoto 9689a34b28 config/module: GetCopy 2014-09-26 16:21:33 -07:00
Mitchell Hashimoto c91fd76fe8 config/module: Get can support subdirs 2014-09-26 16:11:13 -07:00
Mitchell Hashimoto 4fbd5abc63 config/module: support GitHub paths without // 2014-09-26 15:30:36 -07:00
Mitchell Hashimoto 21d90dcf4f config/module: HTTP supports subdirs 2014-09-26 15:22:26 -07:00
Mitchell Hashimoto 7aa30fdf25 config: support subdirectories with the "//" syntax 2014-09-26 14:56:04 -07:00
Mitchell Hashimoto 1ef167602e config/module: validate that required parameters are passed through 2014-09-24 19:40:06 -07:00
Mitchell Hashimoto 718fb42f4b terraform: Plan should use module.Tree 2014-09-24 14:56:48 -07:00
Mitchell Hashimoto 97da02c368 config/module: proper name for root 2014-09-22 16:39:01 -07:00
Mitchell Hashimoto ed538a9594 command: Get command, not functional yet. Converted to use modules. 2014-09-22 10:56:50 -07:00
Mitchell Hashimoto 9a626b3e8c config/module: support HTTP protocol 2014-09-16 13:44:12 -07:00
Mitchell Hashimoto fde151978e config/module: parallelize some things 2014-09-16 12:02:35 -07:00
Mitchell Hashimoto 27564fff2b config/module: detect BitBucket URLs 2014-09-16 11:55:14 -07:00
Mitchell Hashimoto 5480eb4e41 config/module: detect preserves forces 2014-09-16 10:54:23 -07:00
Mitchell Hashimoto 2a655bc7d9 config/module: detect GitHub URLs 2014-09-16 10:52:08 -07:00
Mitchell Hashimoto 9c74d6b5c0 config/module: hg supports branches/tags/etc. 2014-09-16 10:30:55 -07:00
Mitchell Hashimoto feb9a36597 config/module: tests to verify that params are preserved on files 2014-09-16 10:06:44 -07:00
Mitchell Hashimoto ac19a488d2 config/module: support branches in git 2014-09-16 10:02:11 -07:00
Mitchell Hashimoto 13d892217c config/module: fix some issues where tag re-pulling didnt' work 2014-09-16 09:59:09 -07:00
Mitchell Hashimoto dcb900470c config/module: git supports tags 2014-09-16 09:55:51 -07:00
Mitchell Hashimoto 7e94f7d4a9 config/module: Mercurial support 2014-09-16 09:34:23 -07:00
Mitchell Hashimoto fc71d7091f config/module: Git test... this is kind of ghetto 2014-09-16 00:03:20 -07:00
Mitchell Hashimoto 96385113e7 config/module: delete weird subproject business 2014-09-15 23:55:07 -07:00
Mitchell Hashimoto 3e2989daf1 config/module: test Git 2014-09-15 23:52:27 -07:00
Mitchell Hashimoto acb6d12a75 config/module: support forced getters with TYPE::URL syntax 2014-09-15 23:48:56 -07:00
Mitchell Hashimoto cf4885d2fd config/module: git support 2014-09-15 23:32:30 -07:00
Mitchell Hashimoto 7bbf6a0d3a config/module: NewTreeModule is easier to use 2014-09-15 15:49:07 -07:00
Mitchell Hashimoto c0a30d3337 config: TestString 2014-09-15 15:43:12 -07:00
Mitchell Hashimoto 292f57ea0a config/module: validate outputs line up with ModuleVariables 2014-09-15 13:57:07 -07:00
Mitchell Hashimoto 12e7c75211 config/module: validate that parameters into modules valid 2014-09-15 10:32:41 -07:00
Mitchell Hashimoto 2419bf79f2 config/module: error if duplicate module 2014-09-15 09:53:29 -07:00
Mitchell Hashimoto c9fd910c41 config/module: Validate 2014-09-15 09:37:40 -07:00
Mitchell Hashimoto 30b76ef820 config/module: tree.String() 2014-09-14 20:14:37 -07:00
Mitchell Hashimoto 85d1e40644 config/module: can load a tree properly 2014-09-14 20:00:17 -07:00
Mitchell Hashimoto 6eee9fbcb3 config/module: file paths require pwd 2014-09-14 19:28:18 -07:00
Mitchell Hashimoto a35a9262d4 config/module: detectors, some more work on Tree 2014-09-14 16:17:29 -07:00
Mitchell Hashimoto 799ffbb3ac config/module: tree.Modules() 2014-09-14 14:46:45 -07:00
Mitchell Hashimoto 5e4c2b4f49 config/module: test that symlink that exists will be overwritten 2014-09-14 10:36:02 -07:00
Mitchell Hashimoto fa997525c2 config/module: Get tests 2014-09-13 18:58:21 -07:00
Mitchell Hashimoto c2fe35e74e config/module: FileGetter tests 2014-09-13 18:54:12 -07:00
Mitchell Hashimoto bb22090040 config/module: start, lots of initial work 2014-09-13 17:45:56 -07:00