zones: introduce Zones.GetCephConfig() accessor for m/ceph.conf
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
package zones
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"darvaza.org/core"
|
||||
"github.com/gofrs/uuid/v5"
|
||||
|
||||
"git.jpi.io/amery/jpictl/pkg/ceph"
|
||||
)
|
||||
|
||||
// GetCephFSID returns our Ceph's FSID
|
||||
@@ -13,3 +17,14 @@ func (m *Zones) GetCephFSID() (uuid.UUID, error) {
|
||||
}
|
||||
return m.CephFSID, nil
|
||||
}
|
||||
|
||||
// GetCephConfig reads the ceph.conf file
|
||||
func (m *Zones) GetCephConfig() (*ceph.Config, error) {
|
||||
data, err := m.ReadFile("ceph.conf")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
r := bytes.NewReader(data)
|
||||
return ceph.NewConfigFromReader(r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user