Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 28bcaa2838 | |||
| 3cafb1a4e2 | |||
| 09bec11506 | |||
| 14686ff5a8 |
@@ -1 +1,2 @@
|
||||
.tmp
|
||||
.version
|
||||
|
||||
+5
-2
@@ -2,6 +2,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -12,8 +14,9 @@ const (
|
||||
|
||||
var (
|
||||
rootCmd = &cobra.Command{
|
||||
Use: CmdName,
|
||||
Short: "control tool for jpi.cloud",
|
||||
Use: CmdName,
|
||||
Short: "control tool for jpi.cloud",
|
||||
Version: version,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
//go:generate sh -c "git describe | tr -d '\r\n' > .version"
|
||||
//go:embed .version
|
||||
var version string
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Returns jpictl's version",
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
_, _ = fmt.Fprintf(os.Stdout, "%s\n", version)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
if version == "" {
|
||||
version = "undetermined"
|
||||
}
|
||||
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
||||
@@ -39,6 +39,9 @@ func writeGlobalToBuffer(w *bytes.Buffer, c *GlobalConfig) {
|
||||
_, _ = fmt.Fprintf(w, "%s = %s\n", "mon_initial_members", strings.Join(c.Monitors, ", "))
|
||||
_, _ = fmt.Fprintf(w, "%s = %s\n", "mon_host", joinAddrs(c.MonitorsAddr, ", "))
|
||||
_, _ = fmt.Fprintf(w, "%s = %s\n", "cluster_network", c.ClusterNetwork.String())
|
||||
|
||||
_, _ = fmt.Fprintf(w, "\n; %s\n", "don't rewrite labels on startup")
|
||||
_, _ = fmt.Fprintf(w, "%s = %s\n", "osd_class_update_on_start", "false")
|
||||
}
|
||||
|
||||
func joinAddrs(addrs []netip.Addr, sep string) string {
|
||||
|
||||
Reference in New Issue
Block a user