From 05e04c758b25f43c8307bc4b9c1a89b5d9f49d64 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Mon, 4 Sep 2023 19:43:52 +0000 Subject: [PATCH] zones: introduce Zones.GetCephConfig() accessor for m/ceph.conf Signed-off-by: Alejandro Mery --- pkg/zones/ceph.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/zones/ceph.go b/pkg/zones/ceph.go index 94ef7d9..0968ab6 100644 --- a/pkg/zones/ceph.go +++ b/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) +}