Commit 8c2fc383 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Upgrade to feudalScripts v2

parent 23b83a8d
......@@ -5,7 +5,7 @@ import (
"log"
"git.scc.kit.edu/feudal/feudalClient/config"
"git.scc.kit.edu/feudal/feudalScripts"
"git.scc.kit.edu/feudal/feudalScripts/v2"
)
type (
......
module git.scc.kit.edu/feudal/feudalClient
require (
git.scc.kit.edu/feudal/feudalScripts v1.0.1
github.com/koron/iferr v0.0.0-20180615142939-bb332a3b1d91 // indirect
github.com/stamblerre/gocode v0.0.0-20181128172141-22843d89bc5a // indirect
github.com/streadway/amqp v0.0.0-20181107104731-27835f1a64e9
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce // indirect
git.scc.kit.edu/feudal/feudalScripts/v2 v2.0.0
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc // indirect
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/streadway/amqp v0.0.0-20181205114330-a314942b2fd9
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.2.2 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
)
git.scc.kit.edu/feudal/feudalClient v0.1.0/go.mod h1:0h97fa5a+3UqI6rGnkcUhM4DyFvBt4zAXIja+EJbXls=
git.scc.kit.edu/feudal/feudalScripts v1.0.0 h1:ltRwYGdk1klFjZ8wWtYbMqmLt5rZ+cvxWCzLfbknALQ=
git.scc.kit.edu/feudal/feudalScripts v1.0.0/go.mod h1:5+SmQtrtjjLAI5rgZXVVRNvLfwlKw0uRDwWkFq8HUJo=
git.scc.kit.edu/feudal/feudalScripts v1.0.1 h1:XOEqzN50RYxHxdCjfKrGmHeZVpW0X97kC1RPNlxXhhc=
git.scc.kit.edu/feudal/feudalScripts v1.0.1/go.mod h1:IJmsus8xLMsKeb+n8Gqg2J4s6fRtiNwxXNyD+sC9OJU=
git.scc.kit.edu/feudal/feudalScripts/v2 v2.0.0 h1:3907HJ9XEZSuEZ0oAuijssG9SGFjAdmyDt8P7SlFFZY=
git.scc.kit.edu/feudal/feudalScripts/v2 v2.0.0/go.mod h1:EVXrOHOlnw3VZ02LZQDSN7bxldpJ7p31tfKZ5zqAEXA=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/koron/iferr v0.0.0-20180615142939-bb332a3b1d91 h1:hunjgdb3b21ZdRmzDPXii0EcnHpjH7uCP+kODoE1JH0=
github.com/koron/iferr v0.0.0-20180615142939-bb332a3b1d91/go.mod h1:C2tFh8w3I6i4lnUJfoBx2Hwku3mgu4wPNTtUNp1i5KI=
github.com/stamblerre/gocode v0.0.0-20181128172141-22843d89bc5a h1:XVxDNb6jzFAgDYoLAazPpGEe+KBtjc/gLRPcC7taWEw=
github.com/stamblerre/gocode v0.0.0-20181128172141-22843d89bc5a/go.mod h1:EM2T8YDoTCvGXbEpFHxarbpv7VE26QD1++Cb1Pbh7Gs=
github.com/streadway/amqp v0.0.0-20181107104731-27835f1a64e9 h1:xBuwuVDG/vbGv1b0Dn/06flcq0R6MITax8244EZYaKE=
github.com/streadway/amqp v0.0.0-20181107104731-27835f1a64e9/go.mod h1:1WNBiOZtZQLpVAyu0iTduoJL9hEsMloAK5XWrtW0xdY=
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce h1:Gi26mRaGtAreZ9IadlBiwSJT1EDsfk4BSHBD9oxXEFY=
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/streadway/amqp v0.0.0-20181205114330-a314942b2fd9 h1:37QTz/gdHBLQcsmgMTnQDSWCtKzJ7YnfI2M2yTdr4BQ=
github.com/streadway/amqp v0.0.0-20181205114330-a314942b2fd9/go.mod h1:1WNBiOZtZQLpVAyu0iTduoJL9hEsMloAK5XWrtW0xdY=
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
......@@ -14,7 +14,7 @@ import (
"git.scc.kit.edu/feudal/feudalClient/config"
"git.scc.kit.edu/feudal/feudalClient/deployments"
"git.scc.kit.edu/feudal/feudalScripts"
"git.scc.kit.edu/feudal/feudalScripts/v2"
)
type (
......@@ -49,7 +49,7 @@ func (sink *Sink) depServices(dep deps.Dep) (services []config.Service, err erro
} else if dep.VO.ResourceType == "Entitlement" {
sids, ok = sink.Config.EntitlementToServiceIDs[dep.VO.Name]
if !ok {
err = fmt.Errorf("%s: Entitlemnet %s does not exist", dep, dep.VO.Name)
err = fmt.Errorf("%s: Entitlement %s does not exist", dep, dep.VO.Name)
return
}
}
......@@ -88,7 +88,9 @@ func (sink *Sink) scheduleDep(dep deps.Dep) (err error) {
for _, svc := range services {
dep.Service = svc
//dep.Log("Scheduling execution for %s", svc.Name)
if sink.Config.Debug.Scripts {
dep.Log("Scheduling execution for %s", svc.Name)
}
// schedule the deployment
sink.Scheduled <- dep
......@@ -100,10 +102,9 @@ func (sink *Sink) handleDep(dep deps.Dep) (output scripts.Output, err error) {
// encode input as json
input := scripts.Input{
StateTarget: dep.StateTarget,
User: dep.User,
Questionnaire: dep.Questionnaire,
Credentials: dep.User.Credentials,
StateTarget: dep.StateTarget,
User: dep.User,
Answers: dep.Answers,
}
iBytes, err := input.Marshal()
......@@ -310,11 +311,6 @@ func (sink *Sink) depResponder() {
}
}
func (sink *Sink) close() {
close(sink.Scheduled)
close(sink.Replies)
}
// Init initializes the sink
func (sink *Sink) Init(conf *config.Config) {
sink.Config = conf
......@@ -332,12 +328,17 @@ func (sink *Sink) Connect(src <-chan deps.Dep) (err error) {
go func() {
// schedule until the src runs out
var err error
for deps := range src {
sink.scheduleDep(deps)
err = sink.scheduleDep(deps)
if err != nil {
log.Printf("[Sink] Error scheduling: %v", err)
}
}
// closes sink.Replies and sink.Schedule
sink.close()
// clean up before exiting
close(sink.Scheduled)
close(sink.Replies)
}()
return
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment