provider/azurerm: Bump go-autorest to 7.2.1 to fix the issue with VM time parsing

This commit is contained in:
stack72 2016-10-05 01:00:48 +01:00
parent 6ad252e6ab
commit 5c8ded6cf1
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 33 additions and 18 deletions

View File

@ -1,7 +1,7 @@
package date
import (
"strings"
"regexp"
"time"
)
@ -11,6 +11,7 @@ const (
azureUtcFormat = "2006-01-02T15:04:05.999999999"
rfc3339JSON = `"` + time.RFC3339Nano + `"`
rfc3339 = time.RFC3339Nano
tzOffsetRegex = `(Z|z|\+|-)(\d+:\d+)*"*$`
)
// Time defines a type similar to time.Time but assumes a layout of RFC3339 date-time (i.e.,
@ -40,12 +41,14 @@ func (t Time) MarshalJSON() (json []byte, err error) {
// UnmarshalJSON reconstitutes the Time from a JSON string conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z).
func (t *Time) UnmarshalJSON(data []byte) (err error) {
stringData := string(data)
timeFormat := azureUtcFormatJSON
if strings.IndexAny(stringData, "Zz") > -1 {
match, err := regexp.Match(tzOffsetRegex, data)
if err != nil {
return err
} else if match {
timeFormat = rfc3339JSON
}
t.Time, err = ParseTime(timeFormat, stringData)
t.Time, err = ParseTime(timeFormat, string(data))
return err
}
@ -58,12 +61,14 @@ func (t Time) MarshalText() (text []byte, err error) {
// UnmarshalText reconstitutes a Time saved as a byte array conforming to RFC3339 date-time
// (i.e., 2006-01-02T15:04:05Z).
func (t *Time) UnmarshalText(data []byte) (err error) {
stringData := string(data)
timeFormat := azureUtcFormat
if strings.IndexAny(stringData, "Zz") > -1 {
match, err := regexp.Match(tzOffsetRegex, data)
if err != nil {
return err
} else if match {
timeFormat = rfc3339
}
t.Time, err = ParseTime(timeFormat, stringData)
t.Time, err = ParseTime(timeFormat, string(data))
return err
}

32
vendor/vendor.json vendored
View File

@ -202,35 +202,45 @@
"checksumSHA1": "eVSHe6GIHj9/ziFrQLZ1SC7Nn6k=",
"comment": "v7.0.5",
"path": "github.com/Azure/go-autorest/autorest",
"revision": "928711bfb9b6bc052ea85a8f4e1d8f4e1bf55f95",
"revisionTime": "2016-09-27T17:55:41Z"
"revision": "0781901f19f1e7db3034d97ec57af753db0bf808",
"revisionTime": "2016-10-03T18:39:13Z",
"version": "v7.2.1",
"versionExact": "v7.2.1"
},
{
"checksumSHA1": "z8FwqeLK0Pluo7FYC5k2MVBoils=",
"comment": "v7.0.5",
"path": "github.com/Azure/go-autorest/autorest/azure",
"revision": "928711bfb9b6bc052ea85a8f4e1d8f4e1bf55f95",
"revisionTime": "2016-09-27T17:55:41Z"
"revision": "0781901f19f1e7db3034d97ec57af753db0bf808",
"revisionTime": "2016-10-03T18:39:13Z",
"version": "v7.2.1",
"versionExact": "v7.2.1"
},
{
"checksumSHA1": "euBLq6AtwLOQUJfDf1dyR+0nQfU=",
"checksumSHA1": "q9Qz8PAxK5FTOZwgYKe5Lj38u4c=",
"comment": "v7.0.5",
"path": "github.com/Azure/go-autorest/autorest/date",
"revision": "928711bfb9b6bc052ea85a8f4e1d8f4e1bf55f95",
"revisionTime": "2016-09-27T17:55:41Z"
"revision": "0781901f19f1e7db3034d97ec57af753db0bf808",
"revisionTime": "2016-10-03T18:39:13Z",
"version": "v7.2.1",
"versionExact": "v7.2.1"
},
{
"checksumSHA1": "Ev8qCsbFjDlMlX0N2tYAhYQFpUc=",
"comment": "v7.0.5",
"path": "github.com/Azure/go-autorest/autorest/to",
"revision": "928711bfb9b6bc052ea85a8f4e1d8f4e1bf55f95",
"revisionTime": "2016-09-27T17:55:41Z"
"revision": "0781901f19f1e7db3034d97ec57af753db0bf808",
"revisionTime": "2016-10-03T18:39:13Z",
"version": "v7.2.1",
"versionExact": "v7.2.1"
},
{
"checksumSHA1": "oBixceM+55gdk47iff8DSEIh3po=",
"path": "github.com/Azure/go-autorest/autorest/validation",
"revision": "928711bfb9b6bc052ea85a8f4e1d8f4e1bf55f95",
"revisionTime": "2016-09-27T17:55:41Z"
"revision": "0781901f19f1e7db3034d97ec57af753db0bf808",
"revisionTime": "2016-10-03T18:39:13Z",
"version": "v7.2.1",
"versionExact": "v7.2.1"
},
{
"comment": "0.0.2-27-gedd0930",