Commit 94d2582e authored by Lukas Burgey's avatar Lukas Burgey

Upgrade stub-script to v2

parent bbc1bf09
......@@ -7,8 +7,9 @@ import (
"log"
"net/http"
"os"
"time"
s "git.scc.kit.edu/feudal/feudalScripts"
"git.scc.kit.edu/feudal/feudalScripts/v2"
)
const (
......@@ -25,8 +26,9 @@ func check(err error) {
}
}
func deploy(input s.Input) (output s.Output, err error) {
output.State = s.Deployed
func deploy(input scripts.Input) (output scripts.Output, err error) {
time.Sleep(time.Second)
output.State = scripts.Deployed
output.Msg = "deployed"
output.Credentials = map[string]string{
"password": "stub password",
......@@ -35,19 +37,20 @@ func deploy(input s.Input) (output s.Output, err error) {
return
}
func withdraw(input s.Input) (output s.Output, err error) {
output.State = s.NotDeployed
func withdraw(input scripts.Input) (output scripts.Output, err error) {
time.Sleep(time.Second)
output.State = scripts.NotDeployed
output.Msg = "stub remove"
return
}
func handleInput() (output s.Output, err error) {
func handleInput() (output scripts.Output, err error) {
inputBytes, err := ioutil.ReadAll(os.Stdin)
if err != nil {
return
}
input, err := s.UnmarshalInput(inputBytes)
input, err := scripts.UnmarshalInput(inputBytes)
if err != nil {
return
}
......@@ -68,8 +71,8 @@ func main() {
output, err := handleInput()
if err != nil {
output = s.Output{
State: s.Failed,
output = scripts.Output{
State: scripts.Failed,
Msg: fmt.Sprintf("%s", err),
}
}
......
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