fix lint errors
This commit is contained in:
parent
e3881c7df2
commit
77be7652a5
@ -24,7 +24,7 @@ type CommandArg string
|
||||
type Command struct {
|
||||
Path string `json:"path" yaml:"path"`
|
||||
Args []CommandArg `json:"args" yaml:"args"`
|
||||
Split bool `json:"split" yaml:"split`
|
||||
Split bool `json:"split" yaml:"split"`
|
||||
Executor CommandExecutor `json:"-" yaml:"-"`
|
||||
Extractor CommandExtractAttributes `json:"-" yaml:"-"`
|
||||
}
|
||||
|
@ -85,7 +85,9 @@ func (n *ContainerNetwork) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := n.Create(ctx); e != nil {
|
||||
n.stater.Trigger("created")
|
||||
if triggerErr := n.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
n.State = "present"
|
||||
|
@ -129,6 +129,7 @@ func TestDeclarationTransition(t *testing.T) {
|
||||
assert.Nil(t, e)
|
||||
assert.Equal(t, TypeName("file"), resourceDeclaration.Type)
|
||||
assert.Equal(t, fileName, resourceDeclaration.Attributes.(*File).Path)
|
||||
resourceDeclaration.Apply()
|
||||
err := esourceDeclaration.Apply()
|
||||
assert.Nil(t, err)
|
||||
assert.FileExists(t, fileName)
|
||||
}
|
||||
|
@ -120,7 +120,9 @@ func (f *File) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := f.Create(ctx); e != nil {
|
||||
f.stater.Trigger("created")
|
||||
if triggerErr := f.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
f.State = "present"
|
||||
|
@ -71,7 +71,9 @@ func (h *HTTP) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := h.Create(ctx); e != nil {
|
||||
h.stater.Trigger("created")
|
||||
if triggerErr := h.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
h.State = "present"
|
||||
|
@ -165,7 +165,9 @@ func (i *Iptable) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := i.Create(ctx); e != nil {
|
||||
i.stater.Trigger("created")
|
||||
if triggerErr := i.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
i.State = "present"
|
||||
|
@ -154,7 +154,9 @@ func (n *NetworkRoute) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := n.Create(ctx); e != nil {
|
||||
n.stater.Trigger("created")
|
||||
if triggerErr := n.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
n.State = "present"
|
||||
|
@ -110,7 +110,9 @@ func (p *Package) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := p.Create(ctx); e != nil {
|
||||
p.stater.Trigger("created")
|
||||
if triggerErr := p.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
p.State = "present"
|
||||
|
@ -63,16 +63,24 @@ func StorageMachine(sub machine.Subscriber) machine.Stater {
|
||||
stater := machine.New("absent")
|
||||
stater.AddStates("absent", "start_create", "present", "start_delete", "start_read", "start_update")
|
||||
stater.AddTransition("create", "absent", "start_create")
|
||||
stater.AddSubscription("create", sub)
|
||||
if e := stater.AddSubscription("create", sub); e != nil {
|
||||
|
||||
}
|
||||
stater.AddTransition("created", "start_create", "present")
|
||||
stater.AddTransition("read", "*", "start_read")
|
||||
stater.AddSubscription("read", sub)
|
||||
if e := stater.AddSubscription("read", sub); e != nil {
|
||||
|
||||
}
|
||||
stater.AddTransition("state_read", "start_read", "present")
|
||||
stater.AddTransition("update", "*", "start_update")
|
||||
stater.AddSubscription("update", sub)
|
||||
if e := stater.AddSubscription("update", sub); e != nil {
|
||||
|
||||
}
|
||||
stater.AddTransition("updated", "start_update", "present")
|
||||
stater.AddTransition("delete", "*", "start_delete")
|
||||
stater.AddSubscription("delete", sub)
|
||||
if e := stater.AddSubscription("delete", sub); e != nil {
|
||||
|
||||
}
|
||||
stater.AddTransition("deleted", "start_delete", "absent")
|
||||
return stater
|
||||
}
|
||||
|
@ -97,7 +97,9 @@ func (u *User) Notify(m *machine.EventMessage) {
|
||||
switch m.Dest {
|
||||
case "start_create":
|
||||
if e := u.Create(ctx); e != nil {
|
||||
u.stater.Trigger("created")
|
||||
if triggerErr := u.stater.Trigger("created"); triggerErr != nil {
|
||||
// transition error
|
||||
}
|
||||
}
|
||||
case "present":
|
||||
u.State = "present"
|
||||
|
@ -44,7 +44,9 @@ func NewFileDocTarget(u *url.URL, format string, gzip bool, fileUri bool) DocTar
|
||||
} else {
|
||||
t.Path = filepath.Join(u.Hostname(), u.Path)
|
||||
}
|
||||
t.Open()
|
||||
if e := t.Open(); e != nil {
|
||||
// open target
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
@ -67,7 +69,9 @@ func init() {
|
||||
t.Format = FormatJson
|
||||
}
|
||||
}
|
||||
t.Open()
|
||||
if e := t.Open(); e != nil {
|
||||
// open target
|
||||
}
|
||||
return t
|
||||
})
|
||||
|
||||
|
@ -34,7 +34,9 @@ func init() {
|
||||
TargetTypes.Register([]string{"tar"}, func(u *url.URL) DocTarget {
|
||||
t := NewTar()
|
||||
t.Path,_ = filepath.Abs(filepath.Join(u.Hostname(), u.Path))
|
||||
t.Open()
|
||||
if e := t.Open(); e != nil {
|
||||
|
||||
}
|
||||
return t
|
||||
})
|
||||
|
||||
@ -47,7 +49,9 @@ func init() {
|
||||
t.Path = filepath.Join(u.Hostname(), u.Path)
|
||||
}
|
||||
t.Gzip = true
|
||||
t.Open()
|
||||
if e := t.Open(); e != nil {
|
||||
|
||||
}
|
||||
return t
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user