From 41a9844e96d562a5671b18d01178dd08b122c788 Mon Sep 17 00:00:00 2001 From: Pradeep Murugesan Date: Tue, 1 Oct 2019 19:37:08 +0100 Subject: [PATCH 1/7] add the drop inconsistent metadata command to the cli --- cli/commands/metadata.go | 7 ++ cli/commands/metadata_drop_inconsistency.go | 70 +++++++++++++++++++ .../metadata_drop_inconsistency_test.go | 46 ++++++++++++ cli/commands/migrate_test.go | 4 +- cli/migrate/database/hasuradb/metadata.go | 25 +++++++ cli/migrate/database/metadata.go | 2 + cli/migrate/migrate.go | 4 ++ 7 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 cli/commands/metadata_drop_inconsistency.go create mode 100644 cli/commands/metadata_drop_inconsistency_test.go diff --git a/cli/commands/metadata.go b/cli/commands/metadata.go index 43801c2d7759e..9c060684d4c36 100644 --- a/cli/commands/metadata.go +++ b/cli/commands/metadata.go @@ -23,6 +23,7 @@ func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command { newMetadataClearCmd(ec), newMetadataReloadCmd(ec), newMetadataApplyCmd(ec), + newMetadataDropInconsistencyCmd(ec), ) return metadataCmd } @@ -97,6 +98,12 @@ func executeMetadata(cmd string, t *migrate.Migrate, ec *cli.ExecutionContext) e return errors.Wrap(err, "cannot apply metadata on the database") } return nil + + case "dropInconsistency": + err := t.DropInconsistentMetadata() + if err != nil { + return errors.Wrap(err, "cannot reload Metadata") + } } return nil } diff --git a/cli/commands/metadata_drop_inconsistency.go b/cli/commands/metadata_drop_inconsistency.go new file mode 100644 index 0000000000000..f097e5a200712 --- /dev/null +++ b/cli/commands/metadata_drop_inconsistency.go @@ -0,0 +1,70 @@ +package commands + +import ( + "github.com/hasura/graphql-engine/cli" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func newMetadataDropInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { + v := viper.New() + opts := &metadataDropInconsistencyOptions{ + EC: ec, + actionType: "dropInconsistency", + } + + metadataDropInconsistencyCmd := &cobra.Command{ + + Use: "dropInconsistency", + Short: "purge all inconsistent objects from the metadata", + Example: ` # purge all inconsistent objects from the metadata: + hasura metadata dropInconsistency`, + SilenceUsage: true, + PreRunE: func(cmd *cobra.Command, args []string) error { + ec.Viper = v + return ec.Validate() + }, + RunE: func(cmd *cobra.Command, args []string) error { + opts.EC.Spin("Dropping inconsistent metadata...") + err := opts.run() + opts.EC.Spinner.Stop() + if err != nil { + return errors.Wrap(err, "failed to drop inconsistent metadata") + } + opts.EC.Logger.Info("Dropped inconsistent metadata") + return nil + }, + } + + f := metadataDropInconsistencyCmd.Flags() + f.String("endpoint", "", "http(s) endpoint for Hasura GraphQL Engine") + f.String("admin-secret", "", "admin secret for Hasura GraphQL Engine") + f.String("access-key", "", "access key for Hasura GraphQL Engine") + f.MarkDeprecated("access-key", "use --admin-secret instead") + + // need to create a new viper because https://github.com/spf13/viper/issues/233 + v.BindPFlag("endpoint", f.Lookup("endpoint")) + v.BindPFlag("admin_secret", f.Lookup("admin-secret")) + v.BindPFlag("access_key", f.Lookup("access-key")) + + return metadataDropInconsistencyCmd +} + +type metadataDropInconsistencyOptions struct { + EC *cli.ExecutionContext + + actionType string +} + +func (o *metadataDropInconsistencyOptions) run() error { + migrateDrv, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) + if err != nil { + return err + } + err = executeMetadata(o.actionType, migrateDrv, o.EC) + if err != nil { + return errors.Wrap(err, "Cannot reload metadata") + } + return nil +} diff --git a/cli/commands/metadata_drop_inconsistency_test.go b/cli/commands/metadata_drop_inconsistency_test.go new file mode 100644 index 0000000000000..3c9b97f3ae8a8 --- /dev/null +++ b/cli/commands/metadata_drop_inconsistency_test.go @@ -0,0 +1,46 @@ +package commands + +import ( + "github.com/hasura/graphql-engine/cli/version" + "net/url" + "os" + "testing" + "time" + + "github.com/briandowns/spinner" + "github.com/hasura/graphql-engine/cli" + "github.com/sirupsen/logrus/hooks/test" +) + +func testMetadataDropInconsistencyCmd(t *testing.T, migrationsDir string, metadataFile string, endpoint *url.URL) { + logger, _ := test.NewNullLogger() + opts := &metadataDropInconsistencyOptions{ + EC: &cli.ExecutionContext{ + Logger: logger, + Spinner: spinner.New(spinner.CharSets[7], 100*time.Millisecond), + MetadataFile: []string{metadataFile}, + ServerConfig: &cli.ServerConfig{ + Endpoint: endpoint.String(), + AdminSecret: os.Getenv("HASURA_GRAPHQL_TEST_ADMIN_SECRET"), + ParsedEndpoint: endpoint, + }, + MigrationDir: migrationsDir, + + }, + actionType: "dropInconsistency", + } + + opts.EC.Version = version.New() + v, err := version.FetchServerVersion(opts.EC.ServerConfig.Endpoint) + if err != nil { + t.Fatalf("getting server version failed: %v", err) + } + opts.EC.Version.SetServerVersion(v) + + err = opts.run() + if err != nil { + t.Fatalf("failed dropping the inconsistency: %v", err) + } + + os.RemoveAll(opts.EC.MigrationDir) +} diff --git a/cli/commands/migrate_test.go b/cli/commands/migrate_test.go index c169825c3b7a1..bb82bb6e3fb6a 100644 --- a/cli/commands/migrate_test.go +++ b/cli/commands/migrate_test.go @@ -4,6 +4,7 @@ import ( "database/sql" sqldriver "database/sql/driver" "fmt" + "github.com/hasura/graphql-engine/cli/migrate" "io" "io/ioutil" "net/url" @@ -14,7 +15,6 @@ import ( "github.com/Masterminds/semver" - "github.com/hasura/graphql-engine/cli/migrate" mt "github.com/hasura/graphql-engine/cli/migrate/testing" "github.com/hasura/graphql-engine/cli/version" _ "github.com/lib/pq" @@ -263,6 +263,8 @@ func testMigrate(t *testing.T, endpoint *url.URL, migrationsDir string) { testMetadataReset(t, metadataFile, endpoint) testMetadataExport(t, metadataFile, endpoint) compareMetadata(t, metadataFile, "empty-metadata", versionCtx.ServerSemver) + + testMetadataDropInconsistencyCmd(t, migrationsDir, metadataFile, endpoint) } func mustWriteFile(t testing.TB, dir, file string, body string) { diff --git a/cli/migrate/database/hasuradb/metadata.go b/cli/migrate/database/hasuradb/metadata.go index 099486a1bb235..8d869ab8239c0 100644 --- a/cli/migrate/database/hasuradb/metadata.go +++ b/cli/migrate/database/hasuradb/metadata.go @@ -91,6 +91,31 @@ func (h *HasuraDB) ReloadMetadata() error { return nil } +func(h *HasuraDB) DropInconsistentMetadata() error { + query := HasuraInterfaceQuery{ + Type: "drop_inconsistent_metadata", + Args: HasuraArgs{}, + } + + resp, body, err := h.sendv1Query(query) + if err != nil { + h.logger.Debug(err) + return err + } + h.logger.Debug("response: ", string(body)) + + var horror HasuraError + if resp.StatusCode != http.StatusOK { + err = json.Unmarshal(body, &horror) + if err != nil { + h.logger.Debug(err) + return err + } + return horror.Error(h.config.isCMD) + } + return nil +} + func (h *HasuraDB) ApplyMetadata(data interface{}) error { query := HasuraInterfaceBulk{ Type: "bulk", diff --git a/cli/migrate/database/metadata.go b/cli/migrate/database/metadata.go index 598d362c58119..10ce25d869f04 100644 --- a/cli/migrate/database/metadata.go +++ b/cli/migrate/database/metadata.go @@ -7,6 +7,8 @@ type MetadataDriver interface { ReloadMetadata() error + DropInconsistentMetadata() error + ApplyMetadata(data interface{}) error Query(data []interface{}) error diff --git a/cli/migrate/migrate.go b/cli/migrate/migrate.go index bc57ffb525b5e..42cf8b59e9214 100644 --- a/cli/migrate/migrate.go +++ b/cli/migrate/migrate.go @@ -317,6 +317,10 @@ func (m *Migrate) ReloadMetadata() error { return m.databaseDrv.ReloadMetadata() } +func (m *Migrate) DropInconsistentMetadata() error { + return m.databaseDrv.DropInconsistentMetadata() +} + func (m *Migrate) ApplyMetadata(data interface{}) error { return m.databaseDrv.ApplyMetadata(data) } From 3558d850f06f88380b9a3e279ec24ec65d7c6793 Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Fri, 20 Dec 2019 16:57:37 +0530 Subject: [PATCH 2/7] add basic get_inconsistent metadata command --- cli/commands/metadata.go | 4 +- cli/commands/metadata_drop_inconsistency.go | 6 +- cli/commands/metadata_get_inconsistency.go | 69 +++++++++++++++++++++ cli/migrate/database/hasuradb/metadata.go | 6 +- cli/migrate/database/metadata.go | 2 + cli/migrate/migrate.go | 4 ++ 6 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 cli/commands/metadata_get_inconsistency.go diff --git a/cli/commands/metadata.go b/cli/commands/metadata.go index 9c060684d4c36..622bd70ba3a04 100644 --- a/cli/commands/metadata.go +++ b/cli/commands/metadata.go @@ -23,6 +23,7 @@ func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command { newMetadataClearCmd(ec), newMetadataReloadCmd(ec), newMetadataApplyCmd(ec), + newMetadataGetInconsistencyCmd(ec), newMetadataDropInconsistencyCmd(ec), ) return metadataCmd @@ -98,8 +99,9 @@ func executeMetadata(cmd string, t *migrate.Migrate, ec *cli.ExecutionContext) e return errors.Wrap(err, "cannot apply metadata on the database") } return nil + case "get_inconsistent": - case "dropInconsistency": + case "drop_inconsistent": err := t.DropInconsistentMetadata() if err != nil { return errors.Wrap(err, "cannot reload Metadata") diff --git a/cli/commands/metadata_drop_inconsistency.go b/cli/commands/metadata_drop_inconsistency.go index f097e5a200712..c11f0020bbab4 100644 --- a/cli/commands/metadata_drop_inconsistency.go +++ b/cli/commands/metadata_drop_inconsistency.go @@ -11,15 +11,15 @@ func newMetadataDropInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { v := viper.New() opts := &metadataDropInconsistencyOptions{ EC: ec, - actionType: "dropInconsistency", + actionType: "drop_inconsistent", } metadataDropInconsistencyCmd := &cobra.Command{ - Use: "dropInconsistency", + Use: "drop_inconsistent", Short: "purge all inconsistent objects from the metadata", Example: ` # purge all inconsistent objects from the metadata: - hasura metadata dropInconsistency`, + hasura metadata drop_inconsistent`, SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { ec.Viper = v diff --git a/cli/commands/metadata_get_inconsistency.go b/cli/commands/metadata_get_inconsistency.go new file mode 100644 index 0000000000000..c6bfc2bb23e4b --- /dev/null +++ b/cli/commands/metadata_get_inconsistency.go @@ -0,0 +1,69 @@ +package commands + +import ( + "github.com/hasura/graphql-engine/cli" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func newMetadataGetInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { + v := viper.New() + opts := &metadataGetInconsistencyOptions{ + EC: ec, + actionType: "get_inconsistent", + } + + metadataGetInconsistencyCmd := &cobra.Command{ + Use: "get_inconsistent", + Short: "get all inconsistent objects from the metadata", + Example: ` # get all inconsistent objects from the metadata: + hasura metadata get_inconsistent`, + SilenceUsage: true, + PreRunE: func(cmd *cobra.Command, args []string) error { + ec.Viper = v + return ec.Validate() + }, + RunE: func(cmd *cobra.Command, args []string) error { + opts.EC.Spin("Fetching inconsistent metadata...") + err := opts.run() + opts.EC.Spinner.Stop() + if err != nil { + return errors.Wrap(err, "failed to fetch inconsistent metadata") + } + opts.EC.Logger.Info("Fetched inconsistent metadata") + return nil + }, + } + + f := metadataGetInconsistencyCmd.Flags() + f.String("endpoint", "", "http(s) endpoint for Hasura GraphQL Engine") + f.String("admin-secret", "", "admin secret for Hasura GraphQL Engine") + f.String("access-key", "", "access key for Hasura GraphQL Engine") + f.MarkDeprecated("access-key", "use --admin-secret instead") + + // need to create a new viper because https://github.com/spf13/viper/issues/233 + v.BindPFlag("endpoint", f.Lookup("endpoint")) + v.BindPFlag("admin_secret", f.Lookup("admin-secret")) + v.BindPFlag("access_key", f.Lookup("access-key")) + + return metadataGetInconsistencyCmd +} + +type metadataGetInconsistencyOptions struct { + EC *cli.ExecutionContext + + actionType string +} + +func (o *metadataGetInconsistencyOptions) run() error { + migrateDrv, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) + if err != nil { + return err + } + err = executeMetadata(o.actionType, migrateDrv, o.EC) + if err != nil { + return errors.Wrap(err, "Cannot reload metadata") + } + return nil +} diff --git a/cli/migrate/database/hasuradb/metadata.go b/cli/migrate/database/hasuradb/metadata.go index 8d869ab8239c0..0ef5d5446b75a 100644 --- a/cli/migrate/database/hasuradb/metadata.go +++ b/cli/migrate/database/hasuradb/metadata.go @@ -91,7 +91,11 @@ func (h *HasuraDB) ReloadMetadata() error { return nil } -func(h *HasuraDB) DropInconsistentMetadata() error { +func (h *HasuraDB) GetInconsistentMetadata() (interface{}, error) { + return nil, nil +} + +func (h *HasuraDB) DropInconsistentMetadata() error { query := HasuraInterfaceQuery{ Type: "drop_inconsistent_metadata", Args: HasuraArgs{}, diff --git a/cli/migrate/database/metadata.go b/cli/migrate/database/metadata.go index 10ce25d869f04..76e2cbbd20b1b 100644 --- a/cli/migrate/database/metadata.go +++ b/cli/migrate/database/metadata.go @@ -7,6 +7,8 @@ type MetadataDriver interface { ReloadMetadata() error + GetInconsistentMetadata() (interface{}, error) + DropInconsistentMetadata() error ApplyMetadata(data interface{}) error diff --git a/cli/migrate/migrate.go b/cli/migrate/migrate.go index 42cf8b59e9214..a35181f399f20 100644 --- a/cli/migrate/migrate.go +++ b/cli/migrate/migrate.go @@ -317,6 +317,10 @@ func (m *Migrate) ReloadMetadata() error { return m.databaseDrv.ReloadMetadata() } +func (m *Migrate) GetInconsistentMetadata() (interface{}, error) { + return m.databaseDrv.GetInconsistentMetadata() +} + func (m *Migrate) DropInconsistentMetadata() error { return m.databaseDrv.DropInconsistentMetadata() } From dc9121fadf30a46a84287f4cbc7a9c81dc5f6de5 Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Fri, 20 Dec 2019 19:17:41 +0530 Subject: [PATCH 3/7] display in-consistent metadata --- cli/commands/metadata.go | 29 ++++- cli/commands/metadata_get_inconsistency.go | 3 - cli/migrate/database/hasuradb/metadata.go | 37 ++++++- cli/migrate/database/hasuradb/types.go | 121 ++++++++++++++++++++- cli/migrate/database/metadata.go | 9 +- cli/migrate/migrate.go | 2 +- 6 files changed, 189 insertions(+), 12 deletions(-) diff --git a/cli/commands/metadata.go b/cli/commands/metadata.go index 21fae7ad8ff9a..0b5357d3b89dc 100644 --- a/cli/commands/metadata.go +++ b/cli/commands/metadata.go @@ -1,12 +1,16 @@ package commands import ( + "bytes" + "fmt" "io/ioutil" "os" + "text/tabwriter" "github.com/ghodss/yaml" "github.com/hasura/graphql-engine/cli" "github.com/hasura/graphql-engine/cli/migrate" + "github.com/hasura/graphql-engine/cli/util" "github.com/pkg/errors" "github.com/spf13/cobra" v2yaml "gopkg.in/yaml.v2" @@ -96,11 +100,32 @@ func executeMetadata(cmd string, t *migrate.Migrate, ec *cli.ExecutionContext) e } return nil case "get_inconsistent": - + isConsistent, objects, err := t.GetInconsistentMetadata() + if err != nil { + return errors.Wrap(err, "cannot fetch inconsistent metadata") + } + if isConsistent { + return nil + } + out := new(tabwriter.Writer) + buf := &bytes.Buffer{} + out.Init(buf, 0, 8, 2, ' ', 0) + w := util.NewPrefixWriter(out) + w.Write(util.LEVEL_0, "NAME\tTYPE\tDESCRIPTION\tREASON\n") + for _, obj := range objects { + w.Write(util.LEVEL_0, "%s\t%s\t%s\t%s\n", + obj.GetName(), + obj.GetType(), + obj.GetDescription(), + obj.GetReason(), + ) + } + out.Flush() + fmt.Println(buf.String()) case "drop_inconsistent": err := t.DropInconsistentMetadata() if err != nil { - return errors.Wrap(err, "cannot reload Metadata") + return errors.Wrap(err, "cannot drop inconsistent metadata") } } return nil diff --git a/cli/commands/metadata_get_inconsistency.go b/cli/commands/metadata_get_inconsistency.go index c6bfc2bb23e4b..8c28926dbf241 100644 --- a/cli/commands/metadata_get_inconsistency.go +++ b/cli/commands/metadata_get_inconsistency.go @@ -25,13 +25,10 @@ func newMetadataGetInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { return ec.Validate() }, RunE: func(cmd *cobra.Command, args []string) error { - opts.EC.Spin("Fetching inconsistent metadata...") err := opts.run() - opts.EC.Spinner.Stop() if err != nil { return errors.Wrap(err, "failed to fetch inconsistent metadata") } - opts.EC.Logger.Info("Fetched inconsistent metadata") return nil }, } diff --git a/cli/migrate/database/hasuradb/metadata.go b/cli/migrate/database/hasuradb/metadata.go index 263712828ba92..54ee5d13cd12c 100644 --- a/cli/migrate/database/hasuradb/metadata.go +++ b/cli/migrate/database/hasuradb/metadata.go @@ -4,6 +4,8 @@ import ( "encoding/json" "net/http" + "github.com/hasura/graphql-engine/cli/migrate/database" + "github.com/oliveagle/jsonpath" v2yaml "gopkg.in/yaml.v2" ) @@ -91,8 +93,39 @@ func (h *HasuraDB) ReloadMetadata() error { return nil } -func (h *HasuraDB) GetInconsistentMetadata() (interface{}, error) { - return nil, nil +func (h *HasuraDB) GetInconsistentMetadata() (bool, []database.InconsistentMetadataInterface, error) { + query := HasuraInterfaceQuery{ + Type: "get_inconsistent_metadata", + Args: HasuraArgs{}, + } + + resp, body, err := h.sendv1Query(query) + if err != nil { + h.logger.Debug(err) + return false, nil, err + } + h.logger.Debug("response: ", string(body)) + + var horror HasuraError + if resp.StatusCode != http.StatusOK { + err = json.Unmarshal(body, &horror) + if err != nil { + h.logger.Debug(err) + return false, nil, err + } + return false, nil, horror.Error(h.config.isCMD) + } + + var inMet InconsistentMetadata + err = json.Unmarshal(body, &inMet) + if err != nil { + return false, nil, err + } + inMetInterface := make([]database.InconsistentMetadataInterface, 0) + for _, obj := range inMet.InConsistentObjects { + inMetInterface = append(inMetInterface, database.InconsistentMetadataInterface(obj)) + } + return inMet.IsConsistent, inMetInterface, nil } func (h *HasuraDB) DropInconsistentMetadata() error { diff --git a/cli/migrate/database/hasuradb/types.go b/cli/migrate/database/hasuradb/types.go index 5f50f07ffb11f..d77a979fc0ead 100644 --- a/cli/migrate/database/hasuradb/types.go +++ b/cli/migrate/database/hasuradb/types.go @@ -523,9 +523,9 @@ type deleteEventTriggerInput struct { } type addRemoteSchemaInput struct { - Name string `json:"name" yaml:"name"` - Definition interface{} `json:"definition" yaml:"definition"` - Comment *string `json:"comment,omitempty" yaml:"comment,omitempty"` + Name string `json:"name" yaml:"name"` + Definition map[string]interface{} `json:"definition" yaml:"definition"` + Comment *string `json:"comment,omitempty" yaml:"comment,omitempty"` } type removeRemoteSchemaInput struct { @@ -727,6 +727,121 @@ func (rmi *replaceMetadataInput) convertToMetadataActions(l *database.CustomList } } +type InconsistentMetadata struct { + IsConsistent bool `json:"is_consistent"` + InConsistentObjects []InconsistentMeatadataObject `json:"inconsistent_objects"` +} + +type InconsistentMeatadataObject struct { + Type string `json:"type"` + Reason string `json:"reason"` + Definition interface{} `json:"definition"` +} + +func (i *InconsistentMeatadataObject) UnmarshalJSON(b []byte) error { + type t InconsistentMeatadataObject + var q t + if err := json.Unmarshal(b, &q); err != nil { + return err + } + defBody, err := json.Marshal(q.Definition) + if err != nil { + return err + } + switch q.Type { + case "object_relation": + q.Definition = &createObjectRelationshipInput{} + case "array_relation": + q.Definition = &createArrayRelationshipInput{} + case "select_permission": + q.Definition = &createSelectPermissionInput{} + case "update_permission": + q.Definition = &createUpdatePermissionInput{} + case "insert_permission": + q.Definition = &createInsertPermissionInput{} + case "delete_permission": + q.Definition = &createDeletePermissionInput{} + case "table": + q.Definition = &trackTableInput{} + case "function": + q.Definition = &trackFunctionInput{} + case "event_trigger": + q.Definition = &createEventTriggerInput{} + case "remote_schema": + q.Definition = &addRemoteSchemaInput{} + } + if err := json.Unmarshal(defBody, &q.Definition); err != nil { + return err + } + *i = InconsistentMeatadataObject(q) + return nil +} + +func (i InconsistentMeatadataObject) GetType() string { + return i.Type +} + +func (i InconsistentMeatadataObject) GetName() string { + switch defType := i.Definition.(type) { + case *createObjectRelationshipInput: + return defType.Name + case *createArrayRelationshipInput: + return defType.Name + case *createSelectPermissionInput: + return fmt.Sprintf("%s-permission", defType.Role) + case *createUpdatePermissionInput: + return fmt.Sprintf("%s-permission", defType.Role) + case *createInsertPermissionInput: + return fmt.Sprintf("%s-permission", defType.Role) + case *createDeletePermissionInput: + return fmt.Sprintf("%s-permission", defType.Role) + case *trackTableInput: + return defType.Name + case *trackFunctionInput: + return defType.Name + case *createEventTriggerInput: + return defType.Name + case *addRemoteSchemaInput: + return defType.Name + } + return "N/A" +} + +func (i InconsistentMeatadataObject) GetDescription() string { + switch defType := i.Definition.(type) { + case *createObjectRelationshipInput: + return fmt.Sprintf("relationship of table %s in %s schema", defType.Table.Name, defType.Table.Schema) + case *createArrayRelationshipInput: + return fmt.Sprintf("relationship of table %s in %s schema", defType.Table.Name, defType.Table.Schema) + case *createSelectPermissionInput: + return fmt.Sprintf("%s on table %s in %s schema", i.Type, defType.Table.Name, defType.Table.Schema) + case *createUpdatePermissionInput: + return fmt.Sprintf("%s on table %s in %s schema", i.Type, defType.Table.Name, defType.Table.Schema) + case *createInsertPermissionInput: + return fmt.Sprintf("%s on table %s in %s schema", i.Type, defType.Table.Name, defType.Table.Schema) + case *createDeletePermissionInput: + return fmt.Sprintf("%s on table %s in %s schema", i.Type, defType.Table.Name, defType.Table.Schema) + case *trackTableInput: + return fmt.Sprintf("table %s in %s schema", defType.tableSchema.Name, defType.tableSchema.Schema) + case *trackFunctionInput: + return fmt.Sprintf("function %s in %s schema", defType.Name, defType.Schema) + case *createEventTriggerInput: + return fmt.Sprintf("event trigger %s on table %s in %s schema", defType.Name, defType.Table.Name, defType.Table.Schema) + case *addRemoteSchemaInput: + url := defType.Definition["url"] + urlFromEnv, ok := defType.Definition["url_from_env"] + if ok { + url = fmt.Sprintf("the url from the value of env var %s", urlFromEnv) + } + return fmt.Sprintf("remote schema %s at %s", defType.Name, url) + } + return "N/A" +} + +func (i InconsistentMeatadataObject) GetReason() string { + return i.Reason +} + type runSQLInput struct { SQL string `json:"sql" yaml:"sql"` } diff --git a/cli/migrate/database/metadata.go b/cli/migrate/database/metadata.go index 76e2cbbd20b1b..6753dc00dbd4a 100644 --- a/cli/migrate/database/metadata.go +++ b/cli/migrate/database/metadata.go @@ -7,7 +7,7 @@ type MetadataDriver interface { ReloadMetadata() error - GetInconsistentMetadata() (interface{}, error) + GetInconsistentMetadata() (bool, []InconsistentMetadataInterface, error) DropInconsistentMetadata() error @@ -15,3 +15,10 @@ type MetadataDriver interface { Query(data []interface{}) error } + +type InconsistentMetadataInterface interface { + GetType() string + GetName() string + GetDescription() string + GetReason() string +} diff --git a/cli/migrate/migrate.go b/cli/migrate/migrate.go index 1b9033befcf90..118cf2db160c2 100644 --- a/cli/migrate/migrate.go +++ b/cli/migrate/migrate.go @@ -320,7 +320,7 @@ func (m *Migrate) ReloadMetadata() error { return m.databaseDrv.ReloadMetadata() } -func (m *Migrate) GetInconsistentMetadata() (interface{}, error) { +func (m *Migrate) GetInconsistentMetadata() (bool, []database.InconsistentMetadataInterface, error) { return m.databaseDrv.GetInconsistentMetadata() } From af57304c75b24d33c2c04573db17c262f3c9d69d Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Wed, 25 Dec 2019 11:50:10 +0530 Subject: [PATCH 4/7] wip: refactor --- cli/commands/.#metadata_inconsistency_list.go | 1 + cli/commands/metadata.go | 2 +- cli/commands/metadata_inconsistency.go | 17 +++++++++++++++++ ...stency.go => metadata_inconsistency_drop.go} | 0 ...t.go => metadata_inconsistency_drop_test.go} | 0 ...stency.go => metadata_inconsistency_list.go} | 16 +++++++--------- 6 files changed, 26 insertions(+), 10 deletions(-) create mode 120000 cli/commands/.#metadata_inconsistency_list.go create mode 100644 cli/commands/metadata_inconsistency.go rename cli/commands/{metadata_drop_inconsistency.go => metadata_inconsistency_drop.go} (100%) rename cli/commands/{metadata_drop_inconsistency_test.go => metadata_inconsistency_drop_test.go} (100%) rename cli/commands/{metadata_get_inconsistency.go => metadata_inconsistency_list.go} (76%) diff --git a/cli/commands/.#metadata_inconsistency_list.go b/cli/commands/.#metadata_inconsistency_list.go new file mode 120000 index 0000000000000..90398071d5eec --- /dev/null +++ b/cli/commands/.#metadata_inconsistency_list.go @@ -0,0 +1 @@ +shahidh@centaurus.8453:1576950937 \ No newline at end of file diff --git a/cli/commands/metadata.go b/cli/commands/metadata.go index 0b5357d3b89dc..2eff5c2e1329e 100644 --- a/cli/commands/metadata.go +++ b/cli/commands/metadata.go @@ -28,7 +28,7 @@ func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command { newMetadataClearCmd(ec), newMetadataReloadCmd(ec), newMetadataApplyCmd(ec), - newMetadataGetInconsistencyCmd(ec), + newMetadataInconsistencyListCmd(ec), newMetadataDropInconsistencyCmd(ec), ) return metadataCmd diff --git a/cli/commands/metadata_inconsistency.go b/cli/commands/metadata_inconsistency.go new file mode 100644 index 0000000000000..f980812624d7c --- /dev/null +++ b/cli/commands/metadata_inconsistency.go @@ -0,0 +1,17 @@ +package commands + +import ( + "github.com/hasura/graphql-engine/cli" + "github.com/spf13/cobra" +) + +func NewMetadataInconsistecyCmd(ec *cli.ExecutionContext) *cobra.Command { + metadataInconsistencyCmd := &cobra.Command{ + Use: "inconsistency", + Aliases: []string{"inconsistencies", "ic"}, + SilenceUsage: true, + } + + metadataInconsistencyCmd.AddCommand() + return metadataInconsistencyCmd +} diff --git a/cli/commands/metadata_drop_inconsistency.go b/cli/commands/metadata_inconsistency_drop.go similarity index 100% rename from cli/commands/metadata_drop_inconsistency.go rename to cli/commands/metadata_inconsistency_drop.go diff --git a/cli/commands/metadata_drop_inconsistency_test.go b/cli/commands/metadata_inconsistency_drop_test.go similarity index 100% rename from cli/commands/metadata_drop_inconsistency_test.go rename to cli/commands/metadata_inconsistency_drop_test.go diff --git a/cli/commands/metadata_get_inconsistency.go b/cli/commands/metadata_inconsistency_list.go similarity index 76% rename from cli/commands/metadata_get_inconsistency.go rename to cli/commands/metadata_inconsistency_list.go index 8c28926dbf241..8e6285854c9d2 100644 --- a/cli/commands/metadata_get_inconsistency.go +++ b/cli/commands/metadata_inconsistency_list.go @@ -7,18 +7,16 @@ import ( "github.com/spf13/viper" ) -func newMetadataGetInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { +func newMetadataInconsistencyListCmd(ec *cli.ExecutionContext) *cobra.Command { v := viper.New() opts := &metadataGetInconsistencyOptions{ EC: ec, actionType: "get_inconsistent", } - metadataGetInconsistencyCmd := &cobra.Command{ - Use: "get_inconsistent", - Short: "get all inconsistent objects from the metadata", - Example: ` # get all inconsistent objects from the metadata: - hasura metadata get_inconsistent`, + metadataInconsistencyListCmd := &cobra.Command{ + Use: "list", + Short: "list all inconsistent objects from the metadata", SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { ec.Viper = v @@ -27,13 +25,13 @@ func newMetadataGetInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { err := opts.run() if err != nil { - return errors.Wrap(err, "failed to fetch inconsistent metadata") + return errors.Wrap(err, "failed to list inconsistent metadata") } return nil }, } - f := metadataGetInconsistencyCmd.Flags() + f := metadataInconsistencyListCmd.Flags() f.String("endpoint", "", "http(s) endpoint for Hasura GraphQL Engine") f.String("admin-secret", "", "admin secret for Hasura GraphQL Engine") f.String("access-key", "", "access key for Hasura GraphQL Engine") @@ -44,7 +42,7 @@ func newMetadataGetInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { v.BindPFlag("admin_secret", f.Lookup("admin-secret")) v.BindPFlag("access_key", f.Lookup("access-key")) - return metadataGetInconsistencyCmd + return metadataInconsistencyListCmd } type metadataGetInconsistencyOptions struct { From 99351b0f3662736bf59a778549a3c6b043d7b768 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Wed, 25 Dec 2019 13:05:11 +0530 Subject: [PATCH 5/7] fix metadata inconsistency commands --- cli/commands/metadata.go | 37 +---------- cli/commands/metadata_inconsistency.go | 9 ++- cli/commands/metadata_inconsistency_drop.go | 36 ++++------- .../metadata_inconsistency_drop_test.go | 12 ++-- cli/commands/metadata_inconsistency_list.go | 63 +++++++++++++++---- cli/commands/metadata_inconsistency_status.go | 52 +++++++++++++++ cli/commands/migrate_test.go | 2 +- 7 files changed, 134 insertions(+), 77 deletions(-) create mode 100644 cli/commands/metadata_inconsistency_status.go diff --git a/cli/commands/metadata.go b/cli/commands/metadata.go index 2eff5c2e1329e..2cb3508dbf081 100644 --- a/cli/commands/metadata.go +++ b/cli/commands/metadata.go @@ -1,24 +1,22 @@ package commands import ( - "bytes" - "fmt" "io/ioutil" "os" - "text/tabwriter" "github.com/ghodss/yaml" "github.com/hasura/graphql-engine/cli" "github.com/hasura/graphql-engine/cli/migrate" - "github.com/hasura/graphql-engine/cli/util" "github.com/pkg/errors" "github.com/spf13/cobra" v2yaml "gopkg.in/yaml.v2" ) +// NewMetadataCmd returns the metadata command func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command { metadataCmd := &cobra.Command{ Use: "metadata", + Aliases: []string{"md"}, Short: "Manage Hasura GraphQL Engine metadata saved in the database", SilenceUsage: true, } @@ -28,8 +26,7 @@ func NewMetadataCmd(ec *cli.ExecutionContext) *cobra.Command { newMetadataClearCmd(ec), newMetadataReloadCmd(ec), newMetadataApplyCmd(ec), - newMetadataInconsistencyListCmd(ec), - newMetadataDropInconsistencyCmd(ec), + newMetadataInconsistencyCmd(ec), ) return metadataCmd } @@ -99,34 +96,6 @@ func executeMetadata(cmd string, t *migrate.Migrate, ec *cli.ExecutionContext) e return errors.Wrap(err, "cannot apply metadata on the database") } return nil - case "get_inconsistent": - isConsistent, objects, err := t.GetInconsistentMetadata() - if err != nil { - return errors.Wrap(err, "cannot fetch inconsistent metadata") - } - if isConsistent { - return nil - } - out := new(tabwriter.Writer) - buf := &bytes.Buffer{} - out.Init(buf, 0, 8, 2, ' ', 0) - w := util.NewPrefixWriter(out) - w.Write(util.LEVEL_0, "NAME\tTYPE\tDESCRIPTION\tREASON\n") - for _, obj := range objects { - w.Write(util.LEVEL_0, "%s\t%s\t%s\t%s\n", - obj.GetName(), - obj.GetType(), - obj.GetDescription(), - obj.GetReason(), - ) - } - out.Flush() - fmt.Println(buf.String()) - case "drop_inconsistent": - err := t.DropInconsistentMetadata() - if err != nil { - return errors.Wrap(err, "cannot drop inconsistent metadata") - } } return nil } diff --git a/cli/commands/metadata_inconsistency.go b/cli/commands/metadata_inconsistency.go index f980812624d7c..0c06e7487b9ff 100644 --- a/cli/commands/metadata_inconsistency.go +++ b/cli/commands/metadata_inconsistency.go @@ -5,13 +5,18 @@ import ( "github.com/spf13/cobra" ) -func NewMetadataInconsistecyCmd(ec *cli.ExecutionContext) *cobra.Command { +func newMetadataInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { metadataInconsistencyCmd := &cobra.Command{ Use: "inconsistency", + Short: "Manage inconsistent objects in Hasura Metadata", Aliases: []string{"inconsistencies", "ic"}, SilenceUsage: true, } - metadataInconsistencyCmd.AddCommand() + metadataInconsistencyCmd.AddCommand( + newMetadataInconsistencyListCmd(ec), + newMetadataInconsistencyDropCmd(ec), + newMetadataInconsistencyStatusCmd(ec), + ) return metadataInconsistencyCmd } diff --git a/cli/commands/metadata_inconsistency_drop.go b/cli/commands/metadata_inconsistency_drop.go index c11f0020bbab4..dda9f512a5035 100644 --- a/cli/commands/metadata_inconsistency_drop.go +++ b/cli/commands/metadata_inconsistency_drop.go @@ -7,19 +7,15 @@ import ( "github.com/spf13/viper" ) -func newMetadataDropInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { +func newMetadataInconsistencyDropCmd(ec *cli.ExecutionContext) *cobra.Command { v := viper.New() - opts := &metadataDropInconsistencyOptions{ - EC: ec, - actionType: "drop_inconsistent", + opts := &metadataInconsistencyDropOptions{ + EC: ec, } - metadataDropInconsistencyCmd := &cobra.Command{ - - Use: "drop_inconsistent", - Short: "purge all inconsistent objects from the metadata", - Example: ` # purge all inconsistent objects from the metadata: - hasura metadata drop_inconsistent`, + metadataInconsistencyDropCmd := &cobra.Command{ + Use: "drop", + Short: "Drop inconsistent objects from the metadata", SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { ec.Viper = v @@ -32,12 +28,12 @@ func newMetadataDropInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { if err != nil { return errors.Wrap(err, "failed to drop inconsistent metadata") } - opts.EC.Logger.Info("Dropped inconsistent metadata") + opts.EC.Logger.Info("all inconsistent objects removed from metadata") return nil }, } - f := metadataDropInconsistencyCmd.Flags() + f := metadataInconsistencyDropCmd.Flags() f.String("endpoint", "", "http(s) endpoint for Hasura GraphQL Engine") f.String("admin-secret", "", "admin secret for Hasura GraphQL Engine") f.String("access-key", "", "access key for Hasura GraphQL Engine") @@ -48,23 +44,17 @@ func newMetadataDropInconsistencyCmd(ec *cli.ExecutionContext) *cobra.Command { v.BindPFlag("admin_secret", f.Lookup("admin-secret")) v.BindPFlag("access_key", f.Lookup("access-key")) - return metadataDropInconsistencyCmd + return metadataInconsistencyDropCmd } -type metadataDropInconsistencyOptions struct { +type metadataInconsistencyDropOptions struct { EC *cli.ExecutionContext - - actionType string } -func (o *metadataDropInconsistencyOptions) run() error { - migrateDrv, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) +func (o *metadataInconsistencyDropOptions) run() error { + d, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) if err != nil { return err } - err = executeMetadata(o.actionType, migrateDrv, o.EC) - if err != nil { - return errors.Wrap(err, "Cannot reload metadata") - } - return nil + return d.DropInconsistentMetadata() } diff --git a/cli/commands/metadata_inconsistency_drop_test.go b/cli/commands/metadata_inconsistency_drop_test.go index 3c9b97f3ae8a8..a582546e96716 100644 --- a/cli/commands/metadata_inconsistency_drop_test.go +++ b/cli/commands/metadata_inconsistency_drop_test.go @@ -1,20 +1,21 @@ package commands import ( - "github.com/hasura/graphql-engine/cli/version" "net/url" "os" "testing" "time" "github.com/briandowns/spinner" - "github.com/hasura/graphql-engine/cli" "github.com/sirupsen/logrus/hooks/test" + + "github.com/hasura/graphql-engine/cli" + "github.com/hasura/graphql-engine/cli/version" ) -func testMetadataDropInconsistencyCmd(t *testing.T, migrationsDir string, metadataFile string, endpoint *url.URL) { +func testMetadataInconsistencyDropCmd(t *testing.T, migrationsDir string, metadataFile string, endpoint *url.URL) { logger, _ := test.NewNullLogger() - opts := &metadataDropInconsistencyOptions{ + opts := &metadataInconsistencyDropOptions{ EC: &cli.ExecutionContext{ Logger: logger, Spinner: spinner.New(spinner.CharSets[7], 100*time.Millisecond), @@ -25,9 +26,8 @@ func testMetadataDropInconsistencyCmd(t *testing.T, migrationsDir string, metad ParsedEndpoint: endpoint, }, MigrationDir: migrationsDir, - }, - actionType: "dropInconsistency", + actionType: "dropInconsistency", } opts.EC.Version = version.New() diff --git a/cli/commands/metadata_inconsistency_list.go b/cli/commands/metadata_inconsistency_list.go index 8e6285854c9d2..e964c52d4ac11 100644 --- a/cli/commands/metadata_inconsistency_list.go +++ b/cli/commands/metadata_inconsistency_list.go @@ -1,22 +1,29 @@ package commands import ( - "github.com/hasura/graphql-engine/cli" + "bytes" + "fmt" + "text/tabwriter" + "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + + "github.com/hasura/graphql-engine/cli" + "github.com/hasura/graphql-engine/cli/migrate/database" + "github.com/hasura/graphql-engine/cli/util" ) func newMetadataInconsistencyListCmd(ec *cli.ExecutionContext) *cobra.Command { v := viper.New() - opts := &metadataGetInconsistencyOptions{ - EC: ec, - actionType: "get_inconsistent", + opts := &metadataInconsistencyListOptions{ + EC: ec, } metadataInconsistencyListCmd := &cobra.Command{ Use: "list", - Short: "list all inconsistent objects from the metadata", + Aliases: []string{"ls"}, + Short: "List all inconsistent objects from the metadata", SilenceUsage: true, PreRunE: func(cmd *cobra.Command, args []string) error { ec.Viper = v @@ -24,9 +31,13 @@ func newMetadataInconsistencyListCmd(ec *cli.ExecutionContext) *cobra.Command { }, RunE: func(cmd *cobra.Command, args []string) error { err := opts.run() + opts.EC.Spinner.Stop() if err != nil { return errors.Wrap(err, "failed to list inconsistent metadata") } + if opts.isConsistent { + opts.EC.Logger.Println("metadata is consistent") + } return nil }, } @@ -45,20 +56,50 @@ func newMetadataInconsistencyListCmd(ec *cli.ExecutionContext) *cobra.Command { return metadataInconsistencyListCmd } -type metadataGetInconsistencyOptions struct { +type metadataInconsistencyListOptions struct { EC *cli.ExecutionContext - actionType string + isConsistent bool + inconsistentObjects []database.InconsistentMetadataInterface } -func (o *metadataGetInconsistencyOptions) run() error { - migrateDrv, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) +func (o *metadataInconsistencyListOptions) read() error { + d, err := newMigrate(o.EC.MigrationDir, o.EC.ServerConfig.ParsedEndpoint, o.EC.ServerConfig.AdminSecret, o.EC.Logger, o.EC.Version, true) if err != nil { return err } - err = executeMetadata(o.actionType, migrateDrv, o.EC) + o.isConsistent, o.inconsistentObjects, err = d.GetInconsistentMetadata() if err != nil { - return errors.Wrap(err, "Cannot reload metadata") + return err + } + return nil +} + +func (o *metadataInconsistencyListOptions) run() error { + o.EC.Spin("Getting inconsistent metadata...") + + err := o.read() + if err != nil { + return err + } + if o.isConsistent { + return nil + } + out := new(tabwriter.Writer) + buf := &bytes.Buffer{} + out.Init(buf, 0, 8, 2, ' ', 0) + w := util.NewPrefixWriter(out) + w.Write(util.LEVEL_0, "NAME\tTYPE\tDESCRIPTION\tREASON\n") + for _, obj := range o.inconsistentObjects { + w.Write(util.LEVEL_0, "%s\t%s\t%s\t%s\n", + obj.GetName(), + obj.GetType(), + obj.GetDescription(), + obj.GetReason(), + ) } + out.Flush() + o.EC.Spinner.Stop() + fmt.Println(buf.String()) return nil } diff --git a/cli/commands/metadata_inconsistency_status.go b/cli/commands/metadata_inconsistency_status.go new file mode 100644 index 0000000000000..b9a3b26ed3db8 --- /dev/null +++ b/cli/commands/metadata_inconsistency_status.go @@ -0,0 +1,52 @@ +package commands + +import ( + "github.com/hasura/graphql-engine/cli" + "github.com/pkg/errors" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func newMetadataInconsistencyStatusCmd(ec *cli.ExecutionContext) *cobra.Command { + v := viper.New() + opts := &metadataInconsistencyListOptions{ + EC: ec, + } + + metadataInconsistencyStatusCmd := &cobra.Command{ + Use: "status", + Short: "Check if the metadata is inconsistent or not", + SilenceUsage: true, + PreRunE: func(cmd *cobra.Command, args []string) error { + ec.Viper = v + return ec.Validate() + }, + RunE: func(cmd *cobra.Command, args []string) error { + opts.EC.Spin("reading metadata status...") + err := opts.read() + opts.EC.Spinner.Stop() + if err != nil { + return errors.Wrap(err, "failed to read metadata status") + } + if opts.isConsistent { + opts.EC.Logger.Println("metadata is consistent") + } else { + return errors.New("metadata is inconsistent, use list command to see the objects") + } + return nil + }, + } + + f := metadataInconsistencyStatusCmd.Flags() + f.String("endpoint", "", "http(s) endpoint for Hasura GraphQL Engine") + f.String("admin-secret", "", "admin secret for Hasura GraphQL Engine") + f.String("access-key", "", "access key for Hasura GraphQL Engine") + f.MarkDeprecated("access-key", "use --admin-secret instead") + + // need to create a new viper because https://github.com/spf13/viper/issues/233 + v.BindPFlag("endpoint", f.Lookup("endpoint")) + v.BindPFlag("admin_secret", f.Lookup("admin-secret")) + v.BindPFlag("access_key", f.Lookup("access-key")) + + return metadataInconsistencyStatusCmd +} diff --git a/cli/commands/migrate_test.go b/cli/commands/migrate_test.go index 494dc1926d3b9..454dadb2b18fc 100644 --- a/cli/commands/migrate_test.go +++ b/cli/commands/migrate_test.go @@ -263,7 +263,7 @@ func testMigrate(t *testing.T, endpoint *url.URL, migrationsDir string) { testMetadataExport(t, metadataFile, endpoint) compareMetadata(t, metadataFile, "empty-metadata", versionCtx.ServerSemver) - testMetadataDropInconsistencyCmd(t, migrationsDir, metadataFile, endpoint) + testMetadataInconsistencyDropCmd(t, migrationsDir, metadataFile, endpoint) } func mustWriteFile(t testing.TB, dir, file string, body string) { From f92420b38934c9c6fc0830007c1f9c69959915dc Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Wed, 25 Dec 2019 13:12:40 +0530 Subject: [PATCH 6/7] remove emacs cache file --- cli/commands/.#metadata_inconsistency_list.go | 1 - 1 file changed, 1 deletion(-) delete mode 120000 cli/commands/.#metadata_inconsistency_list.go diff --git a/cli/commands/.#metadata_inconsistency_list.go b/cli/commands/.#metadata_inconsistency_list.go deleted file mode 120000 index 90398071d5eec..0000000000000 --- a/cli/commands/.#metadata_inconsistency_list.go +++ /dev/null @@ -1 +0,0 @@ -shahidh@centaurus.8453:1576950937 \ No newline at end of file From 1c2b7f3e51346b1304492425dc78f8731e181226 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Wed, 25 Dec 2019 13:22:26 +0530 Subject: [PATCH 7/7] fix tests --- cli/commands/metadata_inconsistency_drop_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/commands/metadata_inconsistency_drop_test.go b/cli/commands/metadata_inconsistency_drop_test.go index a582546e96716..69669bdc10ce1 100644 --- a/cli/commands/metadata_inconsistency_drop_test.go +++ b/cli/commands/metadata_inconsistency_drop_test.go @@ -27,7 +27,6 @@ func testMetadataInconsistencyDropCmd(t *testing.T, migrationsDir string, metada }, MigrationDir: migrationsDir, }, - actionType: "dropInconsistency", } opts.EC.Version = version.New()