Skip to content

Commit a34fc10

Browse files
anoopcs9mergify[bot]
authored andcommitted
internal/util: Add a wrapper to return server version as a string
Signed-off-by: Anoop C S <[email protected]>
1 parent 1f461a1 commit a34fc10

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Diff for: internal/util/util.go

+21
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,33 @@ const (
1616
CephUnknown
1717
)
1818

19+
// List of known CephVersion strings
20+
const (
21+
Nautilus = "nautilus"
22+
Octopus = "octopus"
23+
Pacific = "pacific"
24+
Quincy = "quincy"
25+
Reef = "reef"
26+
Squid = "squid"
27+
Tentacle = "tentacle"
28+
Main = "main"
29+
)
30+
1931
// CurrentCephVersion is the current Ceph version
2032
func CurrentCephVersion() CephVersion {
2133
vname := os.Getenv("CEPH_VERSION")
2234
return CephVersionOfString(vname)
2335
}
2436

37+
// CurrentCephVersionString is the current Ceph version string
38+
func CurrentCephVersionString() string {
39+
switch vname := os.Getenv("CEPH_VERSION"); vname {
40+
case Nautilus, Octopus, Pacific, Quincy, Reef, Squid, Tentacle, Main:
41+
return vname
42+
}
43+
return ""
44+
}
45+
2546
// CephVersionOfString converts a string to CephVersion
2647
func CephVersionOfString(vname string) CephVersion {
2748
switch vname {

0 commit comments

Comments
 (0)