Browse Source

zones: introduce Zones.GetCephConfig() accessor for m/ceph.conf

Signed-off-by: Alejandro Mery <amery@jpi.io>
pull/9/head
Alejandro Mery 1 year ago
parent
commit
05e04c758b
  1. 15
      pkg/zones/ceph.go

15
pkg/zones/ceph.go

@ -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)
}

Loading…
Cancel
Save