From f290330dbc0af5c74fe440603484190dbe814ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Thu, 23 Jun 2022 11:08:40 +0200 Subject: [PATCH 1/2] Actually use the sharing configuraion from the config file --- ocis/pkg/command/migrate.go | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/ocis/pkg/command/migrate.go b/ocis/pkg/command/migrate.go index b45bdf1883..11bc486687 100644 --- a/ocis/pkg/command/migrate.go +++ b/ocis/pkg/command/migrate.go @@ -12,8 +12,10 @@ import ( "github.com/cs3org/reva/v2/pkg/share" "github.com/cs3org/reva/v2/pkg/share/manager/registry" sharing "github.com/owncloud/ocis/v2/extensions/sharing/pkg/config" + sharingparser "github.com/owncloud/ocis/v2/extensions/sharing/pkg/config/parser" "github.com/owncloud/ocis/v2/ocis-pkg/config" "github.com/owncloud/ocis/v2/ocis-pkg/config/parser" + "github.com/owncloud/ocis/v2/ocis/pkg/register" "github.com/rs/zerolog" "github.com/urfave/cli/v2" @@ -26,10 +28,18 @@ func Migrate(cfg *config.Config) *cli.Command { Usage: "migrate data from an existing to another instance", Category: "migration", Before: func(c *cli.Context) error { + // Parse base config if err := parser.ParseConfig(cfg, true); err != nil { fmt.Printf("%v", err) return err } + + // Parse sharing config + cfg.Sharing.Commons = cfg.Commons + if err := sharingparser.ParseConfig(cfg.Sharing); err != nil { + fmt.Printf("%v", err) + return err + } return nil }, Subcommands: []*cli.Command{ @@ -59,14 +69,6 @@ func MigrateShares(cfg *config.Config) *cli.Command { Usage: "Share manager to import the data into", }, }, - Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg, true) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return nil - }, Action: func(c *cli.Context) error { log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() ctx := log.WithContext(context.Background()) @@ -152,14 +154,6 @@ func MigratePublicShares(cfg *config.Config) *cli.Command { Usage: "Public share manager to import the data into", }, }, - Before: func(c *cli.Context) error { - err := parser.ParseConfig(cfg, true) - if err != nil { - fmt.Printf("%v", err) - os.Exit(1) - } - return err - }, Action: func(c *cli.Context) error { log := zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger() ctx := log.WithContext(context.Background()) From 76f7bddfe827e3693df3554148d175588d29688d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Duffeck?= Date: Mon, 27 Jun 2022 10:19:55 +0200 Subject: [PATCH 2/2] Add changelog --- changelog/unreleased/migrate-command.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/unreleased/migrate-command.md diff --git a/changelog/unreleased/migrate-command.md b/changelog/unreleased/migrate-command.md new file mode 100644 index 0000000000..ec3c54f734 --- /dev/null +++ b/changelog/unreleased/migrate-command.md @@ -0,0 +1,6 @@ +Enhancement: New migrate command for migrating shares and public shares + +We added a new `migrate` subcommand which can be used to migrate shares and public shares between different share and publicshare managers. + +https://github.com/owncloud/ocis/pull/3987 +https://github.com/owncloud/ocis/pull/4019