command: expand ~ manually in var-file [GH-273]
This commit is contained in:
parent
69294b1ba3
commit
7b96a9fa06
|
@ -11,6 +11,7 @@ BUG FIXES:
|
|||
|
||||
* core: Fix certain syntax of configuration that could cause hang. [GH-261]
|
||||
* core: `-no-color` flag properly disables color. [GH-250]
|
||||
* core: "~" is expanded in `-var-file` flags. [GH-273]
|
||||
* providers/aws: Refreshing EIP from pre-0.2 state file won't error. [GH-258]
|
||||
* providers/google: Attaching a disk source (not an image) works
|
||||
properly. [GH-254]
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/hashicorp/hcl"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
// FlagVar is a flag.Value implementation for parsing user variables
|
||||
|
@ -56,7 +57,13 @@ func (v *FlagVarFile) Set(raw string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func loadVarFile(path string) (map[string]string, error) {
|
||||
func loadVarFile(rawPath string) (map[string]string, error) {
|
||||
path, err := homedir.Expand(rawPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf(
|
||||
"Error expanding path: %s", err)
|
||||
}
|
||||
|
||||
// Read the HCL file and prepare for parsing
|
||||
d, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue