Skip to content

Commit

Permalink
make version command registry aware
Browse files Browse the repository at this point in the history
  • Loading branch information
refs committed Nov 12, 2020
1 parent 092723b commit 641fd27
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 16 deletions.
5 changes: 3 additions & 2 deletions accounts/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/accounts/pkg/config"
"github.com/owncloud/ocis/accounts/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListAccountsWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Server.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get accounts services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions konnectd/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/konnectd/pkg/config"
"github.com/owncloud/ocis/konnectd/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListKonnectdWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get konnectd services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions ocs/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/ocs/pkg/config"
"github.com/owncloud/ocis/ocs/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListOcsWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get ocs services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions proxy/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/proxy/pkg/config"
"github.com/owncloud/ocis/proxy/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListProxyWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get proxy services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions settings/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/settings/pkg/config"
"github.com/owncloud/ocis/settings/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListSettingsWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.GRPC.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get settings services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions store/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/store/pkg/config"
"github.com/owncloud/ocis/store/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListStoreWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get store services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions thumbnails/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/thumbnails/pkg/config"
"github.com/owncloud/ocis/thumbnails/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListThumbnailsWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Server.Namespace + "." + cfg.Server.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get thumbnails services from the registry: %v", err))
Expand Down
5 changes: 3 additions & 2 deletions webdav/pkg/command/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"fmt"
"os"

"github.com/owncloud/ocis/ocis-pkg/registry"

"github.com/micro/cli/v2"
"github.com/micro/go-micro/v2/registry/mdns"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/webdav/pkg/config"
"github.com/owncloud/ocis/webdav/pkg/flagset"
Expand All @@ -18,7 +19,7 @@ func PrintVersion(cfg *config.Config) *cli.Command {
Usage: "Print the versions of the running instances",
Flags: flagset.ListWebdavWithConfig(cfg),
Action: func(c *cli.Context) error {
reg := mdns.NewRegistry()
reg := *registry.GetRegistry()
services, err := reg.GetService(cfg.Service.Namespace + "." + cfg.Service.Name)
if err != nil {
fmt.Println(fmt.Errorf("could not get webdav services from the registry: %v", err))
Expand Down

0 comments on commit 641fd27

Please sign in to comment.