resources: augeas: Turn augeas namespace into a constant
This commit is contained in:
@@ -33,6 +33,11 @@ import (
|
|||||||
"honnef.co/go/augeas"
|
"honnef.co/go/augeas"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// NS is a namespace for augeas operations
|
||||||
|
NS = "Xmgmt"
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
gob.Register(&AugeasRes{})
|
gob.Register(&AugeasRes{})
|
||||||
}
|
}
|
||||||
@@ -202,10 +207,10 @@ func (obj *AugeasRes) CheckApply(apply bool) (bool, error) {
|
|||||||
// We pick Xmgmt, as this name will not collide with any other lens name.
|
// We pick Xmgmt, as this name will not collide with any other lens name.
|
||||||
// We do not pick Mgmt as in the future there might be an Mgmt lens.
|
// We do not pick Mgmt as in the future there might be an Mgmt lens.
|
||||||
// https://github.com/hercules-team/augeas/wiki/Loading-specific-files
|
// https://github.com/hercules-team/augeas/wiki/Loading-specific-files
|
||||||
if err = ag.Set("/augeas/load/Xmgmt/lens", obj.Lens); err != nil {
|
if err = ag.Set(fmt.Sprintf("/augeas/load/%s/lens", NS), obj.Lens); err != nil {
|
||||||
return false, errwrap.Wrapf(err, "augeas: error while initializing lens")
|
return false, errwrap.Wrapf(err, "augeas: error while initializing lens")
|
||||||
}
|
}
|
||||||
if err = ag.Set("/augeas/load/Xmgmt/incl", obj.File); err != nil {
|
if err = ag.Set(fmt.Sprintf("/augeas/load/%s/incl", NS), obj.File); err != nil {
|
||||||
return false, errwrap.Wrapf(err, "augeas: error while initializing incl")
|
return false, errwrap.Wrapf(err, "augeas: error while initializing incl")
|
||||||
}
|
}
|
||||||
if err = ag.Load(); err != nil {
|
if err = ag.Load(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user