Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Update configuration field for private key passphrase #81

Merged
merged 2 commits into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ auth:
-----BEGIN RSA PRIVATE KEY-----
<snip>
-----END RSA PRIVATE KEY-----
passphrase: my secret passphrase
fingerprint: d4:1d:8c:d9:8f:00:b2:04:e9:80:09:98:ec:f8:42:7e
vcn: ocid1.vcn.oc1.phx.aaaaaaaaqiqmei4yen2fuyqaiqfcejpguqs6tuaf2n2iaxiwf5cfji2s636a
```
Expand Down
10 changes: 9 additions & 1 deletion pkg/oci/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"

Expand All @@ -44,7 +45,8 @@ type AuthConfig struct {
CompartmentOCID string `yaml:"compartment"`
UserOCID string `yaml:"user"`
PrivateKey string `yaml:"key"`
PrivateKeyPassphrase string `yaml:"key_passphase"`
Passphrase string `yaml:"passphrase"`
PrivateKeyPassphrase string `yaml:"key_passphase"` // DEPRECIATED
Fingerprint string `yaml:"fingerprint"`
VcnOCID string `yaml:"vcn"`
}
Expand Down Expand Up @@ -116,6 +118,12 @@ func (c *Config) setDefaults() error {
if err != nil {
return fmt.Errorf("setting config region fields: %v", err)
}

if c.Auth.Passphrase == "" && c.Auth.PrivateKeyPassphrase != "" {
log.Print("config: auth.key_passphrase is DEPRECIATED and will be removed in a later release. Please set auth.passphrase instead.")
c.Auth.Passphrase = c.Auth.PrivateKeyPassphrase
}

return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/oci/client/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func New(configPath string) (Interface, error) {
config.Auth.Region,
config.Auth.Fingerprint,
config.Auth.PrivateKey,
&config.Auth.PrivateKeyPassphrase,
&config.Auth.Passphrase,
)
computeClient, err := core.NewComputeClientWithConfigurationProvider(configProvider)
if err != nil {
Expand Down