From 76b19170b0a0f6c9d9e5fece48e180c954e9621a Mon Sep 17 00:00:00 2001 From: Wesley Hershberger Date: Mon, 1 Jul 2024 22:17:02 -0500 Subject: [PATCH] example/cmd/microctl: Set microcluster/app version Signed-off-by: Wesley Hershberger --- example/cmd/microctl/cluster_members.go | 15 +++++++++++++-- example/cmd/microctl/extended_cmd.go | 8 +++++++- example/cmd/microctl/main_init.go | 8 +++++++- example/cmd/microctl/shutdown.go | 8 +++++++- example/cmd/microctl/sql.go | 8 +++++++- example/cmd/microctl/tokens.go | 22 +++++++++++++++++++--- example/cmd/microctl/waitready.go | 8 +++++++- 7 files changed, 67 insertions(+), 10 deletions(-) diff --git a/example/cmd/microctl/cluster_members.go b/example/cmd/microctl/cluster_members.go index 5205fae9..cb327519 100644 --- a/example/cmd/microctl/cluster_members.go +++ b/example/cmd/microctl/cluster_members.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" "github.com/canonical/microcluster/client" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -55,7 +56,12 @@ func (c *cmdClusterMembersList) run(cmd *cobra.Command, args []string) error { } // Get all state information for MicroCluster. - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } @@ -114,7 +120,12 @@ func (c *cmdClusterMemberRemove) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } diff --git a/example/cmd/microctl/extended_cmd.go b/example/cmd/microctl/extended_cmd.go index 098d8250..32aa8b3c 100644 --- a/example/cmd/microctl/extended_cmd.go +++ b/example/cmd/microctl/extended_cmd.go @@ -7,6 +7,7 @@ import ( microClient "github.com/canonical/microcluster/client" "github.com/canonical/microcluster/example/client" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -29,7 +30,12 @@ func (c *cmdExtended) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } diff --git a/example/cmd/microctl/main_init.go b/example/cmd/microctl/main_init.go index 664fee59..a544d731 100644 --- a/example/cmd/microctl/main_init.go +++ b/example/cmd/microctl/main_init.go @@ -8,6 +8,7 @@ import ( "github.com/spf13/cobra" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -41,7 +42,12 @@ func (c *cmdInit) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return fmt.Errorf("Unable to configure MicroCluster: %w", err) } diff --git a/example/cmd/microctl/shutdown.go b/example/cmd/microctl/shutdown.go index 2c5f072b..b4e9956c 100644 --- a/example/cmd/microctl/shutdown.go +++ b/example/cmd/microctl/shutdown.go @@ -3,6 +3,7 @@ package main import ( "github.com/spf13/cobra" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -25,7 +26,12 @@ func (c *cmdShutdown) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } diff --git a/example/cmd/microctl/sql.go b/example/cmd/microctl/sql.go index e6a6c56d..a11a17d6 100644 --- a/example/cmd/microctl/sql.go +++ b/example/cmd/microctl/sql.go @@ -7,6 +7,7 @@ import ( "github.com/olekukonko/tablewriter" "github.com/spf13/cobra" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -36,7 +37,12 @@ func (c *cmdSQL) run(cmd *cobra.Command, args []string) error { } } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } diff --git a/example/cmd/microctl/tokens.go b/example/cmd/microctl/tokens.go index 57a75420..5171bbd0 100644 --- a/example/cmd/microctl/tokens.go +++ b/example/cmd/microctl/tokens.go @@ -7,6 +7,7 @@ import ( cli "github.com/canonical/lxd/shared/cmd" "github.com/spf13/cobra" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -56,7 +57,12 @@ func (c *cmdTokensAdd) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } @@ -90,7 +96,12 @@ func (c *cmdTokensList) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } @@ -130,7 +141,12 @@ func (c *cmdTokensRevoke) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err } diff --git a/example/cmd/microctl/waitready.go b/example/cmd/microctl/waitready.go index 0ac806c2..9890b460 100644 --- a/example/cmd/microctl/waitready.go +++ b/example/cmd/microctl/waitready.go @@ -6,6 +6,7 @@ import ( "github.com/spf13/cobra" + "github.com/canonical/microcluster/example/version" "github.com/canonical/microcluster/microcluster" ) @@ -32,7 +33,12 @@ func (c *cmdWaitready) run(cmd *cobra.Command, args []string) error { return cmd.Help() } - m, err := microcluster.App(microcluster.Args{StateDir: c.common.FlagStateDir, Verbose: c.common.FlagLogVerbose, Debug: c.common.FlagLogDebug}) + m, err := microcluster.App(microcluster.Args{ + StateDir: c.common.FlagStateDir, + Verbose: c.common.FlagLogVerbose, + Debug: c.common.FlagLogDebug, + Version: version.Version, + }) if err != nil { return err }