mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-07-07 21:28:41 +00:00
art: Expose to sdk upgrade/list events
This commit is contained in:
parent
be558ead39
commit
b57d97fcab
@ -1,11 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
|
|
||||||
agent "github.com/c3os-io/c3os/internal/agent"
|
agent "github.com/c3os-io/c3os/internal/agent"
|
||||||
"github.com/c3os-io/c3os/internal/bus"
|
"github.com/c3os-io/c3os/internal/bus"
|
||||||
@ -13,9 +10,7 @@ import (
|
|||||||
machine "github.com/c3os-io/c3os/pkg/machine"
|
machine "github.com/c3os-io/c3os/pkg/machine"
|
||||||
bundles "github.com/c3os-io/c3os/sdk/bundles"
|
bundles "github.com/c3os-io/c3os/sdk/bundles"
|
||||||
|
|
||||||
"github.com/c3os-io/c3os/internal/github"
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
"gopkg.in/yaml.v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var cmds = []cli.Command{
|
var cmds = []cli.Command{
|
||||||
@ -60,22 +55,9 @@ See https://docs.c3os.io/after_install/upgrades/#manual for documentation.
|
|||||||
Name: "list-releases",
|
Name: "list-releases",
|
||||||
Description: `List all available releases versions`,
|
Description: `List all available releases versions`,
|
||||||
Action: func(c *cli.Context) error {
|
Action: func(c *cli.Context) error {
|
||||||
rels, err := github.FindReleases(context.Background(), "", "c3os-io/c3os")
|
releases := agent.ListReleases()
|
||||||
if err != nil {
|
for _, r := range releases {
|
||||||
return err
|
fmt.Println(r)
|
||||||
}
|
|
||||||
|
|
||||||
switch strings.ToLower(c.String("output")) {
|
|
||||||
case "yaml":
|
|
||||||
d, _ := yaml.Marshal(rels)
|
|
||||||
fmt.Println(string(d))
|
|
||||||
case "json":
|
|
||||||
d, _ := json.Marshal(rels)
|
|
||||||
fmt.Println(string(d))
|
|
||||||
default:
|
|
||||||
for _, r := range rels {
|
|
||||||
fmt.Println(r)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user