Merge pull request #23865 from loslocostacos/fix-win-tfe-pathing

Fix compatibility issue between Windows CLI and remote plan and apply
This commit is contained in:
Pam Selle 2020-01-22 12:04:41 -05:00 committed by GitHub
commit 9f374eb1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -81,6 +81,11 @@ func ReadManifestSnapshot(r io.Reader) (Manifest, error) {
return nil, fmt.Errorf("invalid version %q for %s: %s", record.VersionStr, record.Key, err) return nil, fmt.Errorf("invalid version %q for %s: %s", record.VersionStr, record.Key, err)
} }
} }
// Ensure Windows is using the proper modules path format after
// reading the modules manifest Dir records
record.Dir = filepath.FromSlash(record.Dir)
if _, exists := new[record.Key]; exists { if _, exists := new[record.Key]; exists {
// This should never happen in any valid file, so we'll catch it // This should never happen in any valid file, so we'll catch it
// and report it to avoid confusing/undefined behavior if the // and report it to avoid confusing/undefined behavior if the
@ -115,6 +120,10 @@ func (m Manifest) WriteSnapshot(w io.Writer) error {
} else { } else {
record.VersionStr = "" record.VersionStr = ""
} }
// Ensure Dir is written in a format that can be read by Linux and
// Windows nodes for remote and apply compatibility
record.Dir = filepath.ToSlash(record.Dir)
write.Records = append(write.Records, record) write.Records = append(write.Records, record)
} }