diff --git a/go.mod b/go.mod index e315c150f..911cc17ee 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/shirou/gopsutil v2.19.11+incompatible github.com/stretchr/testify v1.5.1 github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae - github.com/threefoldtech/tfexplorer v0.2.6 + github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c github.com/threefoldtech/zbus v0.1.3 github.com/urfave/cli v1.22.3 github.com/vishvananda/netlink v1.0.0 diff --git a/go.sum b/go.sum index 6a44f1b2d..efa81cd5e 100644 --- a/go.sum +++ b/go.sum @@ -557,8 +557,8 @@ github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae h1:vgGSvdW5Lqg+I1aZOlG32uyE6xHpLdKhZzcTEktz5wM= github.com/termie/go-shutil v0.0.0-20140729215957-bcacb06fecae/go.mod h1:quDq6Se6jlGwiIKia/itDZxqC5rj6/8OdFyMMAwTxCs= github.com/threefoldtech/tfexplorer v0.2.5/go.mod h1:TugylEDgMNKk4ZIzee9PpVmIcLNLaRLdiXuhHTt/AR0= -github.com/threefoldtech/tfexplorer v0.2.6 h1:Jk8qA5dMVMX9YWZ8IC7zkXiOxClGy2M//OVPmwWe4Cc= -github.com/threefoldtech/tfexplorer v0.2.6/go.mod h1:ozAe2OYR4ALp2PtyKT1A6UiTI+0ZcFU2UfUaRd1P5eE= +github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c h1:5tx6tw6P2uzQCCAAsjubA7p4ozKJXV0TMedIPCbGDgk= +github.com/threefoldtech/tfexplorer v0.2.7-0.20200429090008-f462f9a8d76c/go.mod h1:ozAe2OYR4ALp2PtyKT1A6UiTI+0ZcFU2UfUaRd1P5eE= github.com/threefoldtech/zbus v0.1.3 h1:18DnIzximRbATle5ZdZz0i84n/bCYB8k/gkhr2dXayc= github.com/threefoldtech/zbus v0.1.3/go.mod h1:ZtiRpcqzEBJetVQDsEbw0p48h/AF3O1kf0tvd30I0BU= github.com/threefoldtech/zos v0.2.4-rc2/go.mod h1:7A2oflcmSVsHFC4slOcydWgJyFBMFMH9wsaTRv+CnTA= @@ -784,5 +784,4 @@ gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/provision/primitives/converter.go b/pkg/provision/primitives/converter.go index 0b33bd628..2bf5ae2cb 100644 --- a/pkg/provision/primitives/converter.go +++ b/pkg/provision/primitives/converter.go @@ -249,6 +249,8 @@ func WorkloadToProvisionType(w workloads.ReservationWorkload) (*provision.Reserv if err != nil { return nil, err } + case nil: + // no content, no conversion default: return nil, fmt.Errorf("unknown workload type (%s) (%T)", w.Type.String(), tmp) } diff --git a/pkg/provision/reservation.go b/pkg/provision/reservation.go index 3828a09cc..f247505fb 100644 --- a/pkg/provision/reservation.go +++ b/pkg/provision/reservation.go @@ -15,6 +15,11 @@ import ( // ReservationType type type ReservationType string +const ( + //NOOPReservation type + NOOPReservation ReservationType = "noop" +) + // Reservation struct type Reservation struct { // ID of the reservation diff --git a/pkg/provision/source.go b/pkg/provision/source.go index e86ec57a7..245a734ee 100644 --- a/pkg/provision/source.go +++ b/pkg/provision/source.go @@ -91,6 +91,13 @@ func (s *pollSource) Reservations(ctx context.Context) <-chan *Reservation { if current >= next { next = current + 1 } + + if r.Type == NOOPReservation { + // special type of reservation that does nothing + // we just ignore it here. + continue + } + ch <- r } }