-
Notifications
You must be signed in to change notification settings - Fork 6
/
actor_edit_config.go
36 lines (31 loc) · 1.07 KB
/
actor_edit_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package object
import (
"context"
"github.com/opensvc/om3/core/actioncontext"
"github.com/opensvc/om3/core/statusbus"
"github.com/opensvc/om3/core/xconfig"
)
func (t *actor) RecoverAndEditConfig() error {
ctx := context.Background()
ctx = actioncontext.WithProps(ctx, actioncontext.Set)
ctx, stop := statusbus.WithContext(ctx, t.path)
defer stop()
defer t.postActionStatusEval(ctx)
return xconfig.Edit(t.ConfigFile(), xconfig.EditModeRecover, t.config.Referrer)
}
func (t *actor) DiscardAndEditConfig() error {
ctx := context.Background()
ctx = actioncontext.WithProps(ctx, actioncontext.Set)
ctx, stop := statusbus.WithContext(ctx, t.path)
defer stop()
defer t.postActionStatusEval(ctx)
return xconfig.Edit(t.ConfigFile(), xconfig.EditModeDiscard, t.config.Referrer)
}
func (t *actor) EditConfig() error {
ctx := context.Background()
ctx = actioncontext.WithProps(ctx, actioncontext.Set)
ctx, stop := statusbus.WithContext(ctx, t.path)
defer stop()
defer t.postActionStatusEval(ctx)
return xconfig.Edit(t.ConfigFile(), xconfig.EditModeNormal, t.config.Referrer)
}