f293ead8d5
Signed-off-by: Alejandro Mery <amery@jpi.io>
31 lines
550 B
Go
31 lines
550 B
Go
package zones
|
|
|
|
import (
|
|
"bytes"
|
|
|
|
"git.jpi.io/amery/jpictl/pkg/ceph"
|
|
)
|
|
|
|
// 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)
|
|
}
|
|
|
|
// WriteCephConfig writes the ceph.conf file
|
|
func (m *Zones) WriteCephConfig(cfg *ceph.Config) error {
|
|
f, err := m.CreateTruncFile("ceph.conf")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer f.Close()
|
|
|
|
_, err = cfg.WriteTo(f)
|
|
return err
|
|
}
|