File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 44
55require (
66 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
7+ github.com/carmo-evan/strtotime v0.0.0-20200108203155-3136cf889e3b // indirect
78 github.com/docker/docker v0.0.0-20180805161158-f57f260b49b6 // indirect
89 github.com/docker/machine v0.16.2
910 github.com/google/go-cmp v0.3.0 // indirect
Original file line number Diff line number Diff line change 11github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8 =
22github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 /go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8 =
3+ github.com/carmo-evan/strtotime v0.0.0-20200108203155-3136cf889e3b h1:U3vQoEOmB8zQ34LR8jQt6XMIdOiq49OZ1aPGjG1fJKE =
4+ github.com/carmo-evan/strtotime v0.0.0-20200108203155-3136cf889e3b /go.mod h1:IqY2NtbgybBNEdxOZLXCF/OAAisAOiB4+F7/ovbQN8M =
35github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 =
46github.com/davecgh/go-spew v1.1.0 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
57github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c =
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
1010 "strings"
1111 "time"
1212
13+ "github.com/carmo-evan/strtotime"
1314 "github.com/docker/machine/libmachine/drivers"
1415 "github.com/docker/machine/libmachine/log"
1516 "github.com/docker/machine/libmachine/mcnflag"
@@ -173,12 +174,14 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
173174 if TerminationTime == "" {
174175 d .TerminationTime = nil
175176 } else {
176- layout := "2006-01-02T15:04:05.000Z"
177- TerminationTime , err := time .Parse (layout , TerminationTime )
177+ Timestamp , err := strtotime .Parse (TerminationTime , time .Now ().Unix ())
178178 if err != nil {
179179 return err
180180 }
181- d .TerminationTime .Time = TerminationTime
181+ if Timestamp <= time .Now ().Unix () {
182+ return fmt .Errorf ("--metal-termination-time cannot be in the past" )
183+ }
184+ d .TerminationTime = & packngo.Timestamp {Time : time .Unix (Timestamp , 0 )}
182185 }
183186 }
184187
@@ -267,6 +270,7 @@ func (d *Driver) Create() error {
267270 Tags : d .Tags ,
268271 SpotInstance : d .SpotInstance ,
269272 SpotPriceMax : d .SpotPriceMax ,
273+ TerminationTime : d .TerminationTime ,
270274 }
271275
272276 log .Info ("Provisioning Equinix Metal server..." )
You can’t perform that action at this time.
0 commit comments