resources: exec: Remove the pollint parameter
Since we now have a poll metaparameter, we don't need the resource specific code.
This commit is contained in:
@@ -46,7 +46,6 @@ type ExecRes struct {
|
|||||||
WatchShell string `yaml:"watchshell"` // the (optional) shell to use to run the watch cmd
|
WatchShell string `yaml:"watchshell"` // the (optional) shell to use to run the watch cmd
|
||||||
IfCmd string `yaml:"ifcmd"` // the if command to run
|
IfCmd string `yaml:"ifcmd"` // the if command to run
|
||||||
IfShell string `yaml:"ifshell"` // the (optional) shell to use to run the if cmd
|
IfShell string `yaml:"ifshell"` // the (optional) shell to use to run the if cmd
|
||||||
PollInt int `yaml:"pollint"` // the poll interval for the ifcmd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default returns some sensible defaults for this resource.
|
// Default returns some sensible defaults for this resource.
|
||||||
@@ -64,11 +63,6 @@ func (obj *ExecRes) Validate() error {
|
|||||||
return fmt.Errorf("command can't be empty")
|
return fmt.Errorf("command can't be empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have a watch command, then we don't poll with the if command!
|
|
||||||
if obj.WatchCmd != "" && obj.PollInt > 0 {
|
|
||||||
return fmt.Errorf("don't poll when we have a watch command")
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj.BaseRes.Validate()
|
return obj.BaseRes.Validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,12 +188,6 @@ func (obj *ExecRes) CheckApply(apply bool) (checkOK bool, err error) {
|
|||||||
// there is a watcher, but there is also an if command
|
// there is a watcher, but there is also an if command
|
||||||
//} else if obj.IfCmd != "" && obj.WatchCmd != "" {
|
//} else if obj.IfCmd != "" && obj.WatchCmd != "" {
|
||||||
|
|
||||||
if obj.PollInt > 0 { // && obj.WatchCmd == ""
|
|
||||||
// XXX: have the Watch() command output onlyif poll events...
|
|
||||||
// XXX: we can optimize by saving those results for returning here
|
|
||||||
// return XXX
|
|
||||||
}
|
|
||||||
|
|
||||||
var cmdName string
|
var cmdName string
|
||||||
var cmdArgs []string
|
var cmdArgs []string
|
||||||
if obj.IfShell == "" {
|
if obj.IfShell == "" {
|
||||||
@@ -331,9 +319,6 @@ func (obj *ExecUID) IFF(uid ResUID) bool {
|
|||||||
if obj.IfCmd != res.IfCmd {
|
if obj.IfCmd != res.IfCmd {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
//if obj.PollInt != res.PollInt {
|
|
||||||
// return false
|
|
||||||
//}
|
|
||||||
//if obj.State != res.State {
|
//if obj.State != res.State {
|
||||||
// return false
|
// return false
|
||||||
//}
|
//}
|
||||||
@@ -398,9 +383,6 @@ func (obj *ExecRes) Compare(res Res) bool {
|
|||||||
if obj.IfCmd != res.IfCmd {
|
if obj.IfCmd != res.IfCmd {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if obj.PollInt != res.PollInt {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if obj.State != res.State {
|
if obj.State != res.State {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user