vendor: joyent/gosign/auth update to master (#7208)
Closes hashicorp/terraform#7155.
This commit is contained in:
parent
f65a898a51
commit
cd9b18b961
|
@ -114,22 +114,19 @@ func getHashFunction(algorithm string) (hashFunc crypto.Hash) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cred *Credentials) Region() string {
|
func (cred *Credentials) Region() string {
|
||||||
sdcUrl := cred.SdcEndpoint.URL
|
parsedUrl, err := url.Parse(cred.SdcEndpoint.URL)
|
||||||
|
|
||||||
if isLocalhost(sdcUrl) {
|
|
||||||
return "some-region"
|
|
||||||
}
|
|
||||||
return sdcUrl[strings.LastIndex(sdcUrl, "/")+1 : strings.Index(sdcUrl, ".")]
|
|
||||||
}
|
|
||||||
|
|
||||||
func isLocalhost(u string) bool {
|
|
||||||
parsedUrl, err := url.Parse(u)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
// Bogus URL - no region.
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(parsedUrl.Host, "localhost") || strings.HasPrefix(parsedUrl.Host, "127.0.0.1") {
|
if strings.HasPrefix(parsedUrl.Host, "localhost") || strings.HasPrefix(parsedUrl.Host, "127.0.0.1") {
|
||||||
return true
|
return "some-region"
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
host := parsedUrl.Host
|
||||||
|
firstDotIdx := strings.Index(host, ".")
|
||||||
|
if firstDotIdx >= 0 {
|
||||||
|
return host[:firstDotIdx]
|
||||||
|
}
|
||||||
|
return host
|
||||||
}
|
}
|
||||||
|
|
|
@ -954,8 +954,10 @@
|
||||||
"revision": "0697a5c4f39a71a4f9e3b154380b47dbfcc3da6e"
|
"revision": "0697a5c4f39a71a4f9e3b154380b47dbfcc3da6e"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"checksumSHA1": "N0NRIcJF7aj1wd56DA1N9GpYq/4=",
|
||||||
"path": "github.com/joyent/gosign/auth",
|
"path": "github.com/joyent/gosign/auth",
|
||||||
"revision": "a1f3aa7d52213987117e47d721bcc9a499994d5f"
|
"revision": "8978c75ffefb3f63a977ad9cbfce40caeb40177e",
|
||||||
|
"revisionTime": "2016-06-16T18:50:15Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"comment": "v0.3.0-33-g53d1c0a",
|
"comment": "v0.3.0-33-g53d1c0a",
|
||||||
|
|
Loading…
Reference in New Issue