Compare commits

...

4 Commits

Author SHA1 Message Date
karasz 28bcaa2838 Merge pull request 'jpictl: add --version and version command' (#44) from pr-amery-version into main
Reviewed-on: #44
2024-03-09 11:09:33 +01:00
karasz 3cafb1a4e2 Merge pull request 'ceph: prevent osd label update on startup' (#41) from pr-amery-ceph into main
Reviewed-on: #41
2024-03-09 11:08:30 +01:00
amery 09bec11506 jpictl: add --version and version command
from `git describe` using go:generate and embed

Signed-off-by: Alejandro Mery <amery@jpi.io>
2024-03-02 23:15:56 +00:00
amery 14686ff5a8 ceph: prevent osd label update on startup
Signed-off-by: Alejandro Mery <amery@jpi.io>
2024-03-02 19:16:37 +00:00
4 changed files with 40 additions and 2 deletions
+1
View File
@@ -1 +1,2 @@
.tmp
.version
+5 -2
View File
@@ -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,
}
)
+31
View File
@@ -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)
}
+3
View File
@@ -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 {