Skip to content

Commit

Permalink
example/cmd/microctl: Set microcluster/app version
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins committed Jul 2, 2024
1 parent f46125b commit 76b1917
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 10 deletions.
15 changes: 13 additions & 2 deletions example/cmd/microctl/cluster_members.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion example/cmd/microctl/extended_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion example/cmd/microctl/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/spf13/cobra"

"github.com/canonical/microcluster/example/version"
"github.com/canonical/microcluster/microcluster"
)

Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 7 additions & 1 deletion example/cmd/microctl/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"github.com/spf13/cobra"

"github.com/canonical/microcluster/example/version"
"github.com/canonical/microcluster/microcluster"
)

Expand All @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion example/cmd/microctl/sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"

"github.com/canonical/microcluster/example/version"
"github.com/canonical/microcluster/microcluster"
)

Expand Down Expand Up @@ -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
}
Expand Down
22 changes: 19 additions & 3 deletions example/cmd/microctl/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 7 additions & 1 deletion example/cmd/microctl/waitready.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/spf13/cobra"

"github.com/canonical/microcluster/example/version"
"github.com/canonical/microcluster/microcluster"
)

Expand All @@ -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
}
Expand Down

0 comments on commit 76b1917

Please sign in to comment.