Commit a91b8f68 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/googlecompute: only load secrets/private key if given

parent 501238b2
......@@ -163,6 +163,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
}
c.stateTimeout = stateTimeout
if c.ClientSecretsFile != "" {
// Load the client secrets file.
cs, err := loadClientSecrets(c.ClientSecretsFile)
if err != nil {
......@@ -170,13 +171,16 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
errs, fmt.Errorf("Failed parsing client secrets file: %s", err))
}
c.clientSecrets = cs
}
if c.PrivateKeyFile != "" {
// Load the private key.
c.privateKeyBytes, err = processPrivateKeyFile(c.PrivateKeyFile, c.Passphrase)
if err != nil {
errs = packer.MultiErrorAppend(
errs, fmt.Errorf("Failed loading private key file: %s", err))
}
}
// Check for any errors.
if errs != nil && len(errs.Errors) > 0 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment