From 35774fec8b06c7950c1d4c595257d107808561a9 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 11 Dec 2020 14:13:15 +0100 Subject: [PATCH 1/3] small defensive code additions --- ocis/pkg/runtime/runtime.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ocis/pkg/runtime/runtime.go b/ocis/pkg/runtime/runtime.go index bea1d997352..24eb752b45c 100644 --- a/ocis/pkg/runtime/runtime.go +++ b/ocis/pkg/runtime/runtime.go @@ -34,8 +34,6 @@ var ( // Extensions are ocis extension services Extensions = []string{ "glauth", - "graph", - "graph-explorer", "konnectd", "ocs", "onlyoffice", @@ -54,6 +52,8 @@ var ( "storage-public-link", "thumbnails", "webdav", + //"graph", + //"graph-explorer", } // There seem to be a race condition when reva-sharing needs to read the sharing.json file and the parent folder is not present. @@ -129,6 +129,11 @@ OUT: func RunService(client *rpc.Client, service string) int { args := process.NewProcEntry(service, os.Environ(), []string{service}...) + all := append(Extensions, append(dependants, MicroServices...)...) + if !contains(all, service) { + return 1 + } + var reply int if err := client.Call("Service.Start", args, &reply); err != nil { golog.Fatal(err) @@ -159,3 +164,12 @@ func setDefaults() { // registry registry.Name = OwncloudNamespace + "registry" } + +func contains(a []string, b string) bool { + for i := range a { + if a[i] == b { + return true + } + } + return false +} From b9ce04338c4b689cd0459c2b60282ff4be5c3710 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 11 Dec 2020 14:14:42 +0100 Subject: [PATCH 2/3] add changelog --- changelog/unreleased/runtime-cleanup.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/runtime-cleanup.md diff --git a/changelog/unreleased/runtime-cleanup.md b/changelog/unreleased/runtime-cleanup.md new file mode 100644 index 00000000000..9529a6a6053 --- /dev/null +++ b/changelog/unreleased/runtime-cleanup.md @@ -0,0 +1,5 @@ +Enhancement: Runtime Cleanup + +Small runtime cleanup prior to Tech Preview release + +https://github.com/owncloud/ocis/pull/1066 From 7bba6bcb6a807d4ad2743d056564e249a29d3df3 Mon Sep 17 00:00:00 2001 From: "A.Unger" Date: Fri, 11 Dec 2020 14:16:51 +0100 Subject: [PATCH 3/3] increase log level for missing config on default location to debug --- accounts/pkg/command/root.go | 2 +- glauth/pkg/command/root.go | 2 +- konnectd/pkg/command/root.go | 2 +- ocis-phoenix/pkg/command/root.go | 2 +- ocis/pkg/command/root.go | 2 +- ocs/pkg/command/root.go | 2 +- settings/pkg/command/root.go | 2 +- storage/pkg/command/root.go | 2 +- store/pkg/command/root.go | 2 +- thumbnails/pkg/command/root.go | 2 +- webdav/pkg/command/root.go | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/accounts/pkg/command/root.go b/accounts/pkg/command/root.go index 4c8bda1c52f..19088bb0d62 100644 --- a/accounts/pkg/command/root.go +++ b/accounts/pkg/command/root.go @@ -97,7 +97,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/glauth/pkg/command/root.go b/glauth/pkg/command/root.go index 9366a643829..bccefd6d68d 100644 --- a/glauth/pkg/command/root.go +++ b/glauth/pkg/command/root.go @@ -86,7 +86,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/konnectd/pkg/command/root.go b/konnectd/pkg/command/root.go index 9cec2f2ba8a..d57dd8f47fc 100644 --- a/konnectd/pkg/command/root.go +++ b/konnectd/pkg/command/root.go @@ -87,7 +87,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/ocis-phoenix/pkg/command/root.go b/ocis-phoenix/pkg/command/root.go index d03c2d279d9..35e7ea2e085 100644 --- a/ocis-phoenix/pkg/command/root.go +++ b/ocis-phoenix/pkg/command/root.go @@ -81,7 +81,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/ocis/pkg/command/root.go b/ocis/pkg/command/root.go index f2a109fe5b9..0dfc2f31969 100644 --- a/ocis/pkg/command/root.go +++ b/ocis/pkg/command/root.go @@ -101,7 +101,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/ocs/pkg/command/root.go b/ocs/pkg/command/root.go index 6249dbf5963..71714ba39ec 100644 --- a/ocs/pkg/command/root.go +++ b/ocs/pkg/command/root.go @@ -87,7 +87,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/settings/pkg/command/root.go b/settings/pkg/command/root.go index f6a2ed6ae14..6998566a3bf 100644 --- a/settings/pkg/command/root.go +++ b/settings/pkg/command/root.go @@ -87,7 +87,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/storage/pkg/command/root.go b/storage/pkg/command/root.go index 5846dad37a8..1278af1f3fb 100644 --- a/storage/pkg/command/root.go +++ b/storage/pkg/command/root.go @@ -51,7 +51,7 @@ func Execute() error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/store/pkg/command/root.go b/store/pkg/command/root.go index 99f5bbbd40b..6c32046818b 100644 --- a/store/pkg/command/root.go +++ b/store/pkg/command/root.go @@ -87,7 +87,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/thumbnails/pkg/command/root.go b/thumbnails/pkg/command/root.go index 0211b24d706..b73e32ad6d7 100644 --- a/thumbnails/pkg/command/root.go +++ b/thumbnails/pkg/command/root.go @@ -87,7 +87,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal(). diff --git a/webdav/pkg/command/root.go b/webdav/pkg/command/root.go index c24cc3e865a..0fb492927a2 100644 --- a/webdav/pkg/command/root.go +++ b/webdav/pkg/command/root.go @@ -86,7 +86,7 @@ func ParseConfig(c *cli.Context, cfg *config.Config) error { if err := viper.ReadInConfig(); err != nil { switch err.(type) { case viper.ConfigFileNotFoundError: - logger.Info(). + logger.Debug(). Msg("no config found on preconfigured location") case viper.UnsupportedConfigError: logger.Fatal().