Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
hostname.DependsOn(health)
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
14 changes: 7 additions & 7 deletions examples/sdk/orchestrator/features/container-targeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
pull.DependsOn(preCleanup)
Expand Down Expand Up @@ -160,7 +160,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
create.DependsOn(pull)
Expand All @@ -187,7 +187,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
execHostname.DependsOn(create)
Expand All @@ -212,7 +212,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
execUname.DependsOn(create)
Expand All @@ -239,7 +239,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
execOS.DependsOn(create)
Expand All @@ -264,7 +264,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
inspect.DependsOn(create)
Expand Down Expand Up @@ -304,7 +304,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
).DependsOn(execHostname, execUname, execOS, inspect)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/error-strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/guards.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
getHostname.DependsOn(health)
Expand Down
4 changes: 2 additions & 2 deletions examples/sdk/orchestrator/features/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
hostname.DependsOn(health)
Expand All @@ -165,7 +165,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
disk.DependsOn(health)
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/only-if-changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
6 changes: 3 additions & 3 deletions examples/sdk/orchestrator/features/parallel.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
hostnameTask.DependsOn(health)
Expand All @@ -137,7 +137,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
diskTask.DependsOn(health)
Expand All @@ -161,7 +161,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
memoryTask.DependsOn(health)
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/result-decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/task-func-results.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
getHostname.DependsOn(health)
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/features/task-func.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)
hostname.DependsOn(health)
Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/command-exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/command-shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-list.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-start.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/docker-stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/network-dns-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/network-dns-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/network-ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-load.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-status.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
2 changes: 1 addition & 1 deletion examples/sdk/orchestrator/operations/node-uptime.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func main() {
Error: r.Error,
}
},
), nil
)
},
)

Expand Down
9 changes: 6 additions & 3 deletions pkg/sdk/orchestrator/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package orchestrator

import (
"encoding/json"
"fmt"

client "github.com/retr0h/osapi/pkg/sdk/client"
)
Expand Down Expand Up @@ -44,7 +45,7 @@ func CollectionResult[T any](
col client.Collection[T],
rawJSON []byte,
toHostResult func(T) HostResult,
) *Result {
) (*Result, error) {
hostResults := make([]HostResult, 0, len(col.Results))
changed := false

Expand All @@ -64,13 +65,15 @@ func CollectionResult[T any](

var data map[string]any
if len(rawJSON) > 0 {
_ = jsonUnmarshalFn(rawJSON, &data)
if err := jsonUnmarshalFn(rawJSON, &data); err != nil {
return nil, fmt.Errorf("unmarshal response data: %w", err)
}
}

return &Result{
JobID: col.JobID,
Changed: changed,
Data: data,
HostResults: hostResults,
}
}, nil
}
Loading
Loading