engine: Add a ctx to the CheckApply API
This is just a rough port, there are lots of optimizations to be done and lots of timeout values that should be replaced by a new timeout meta param!
This commit is contained in:
@@ -238,7 +238,7 @@ func (obj *SvcRes) Watch(ctx context.Context) error {
|
||||
|
||||
// CheckApply checks the resource state and applies the resource if the bool
|
||||
// input is true. It returns error info and if the state check passed or not.
|
||||
func (obj *SvcRes) CheckApply(apply bool) (bool, error) {
|
||||
func (obj *SvcRes) CheckApply(ctx context.Context, apply bool) (bool, error) {
|
||||
if !systemdUtil.IsRunningSystemd() {
|
||||
return false, fmt.Errorf("systemd is not running")
|
||||
}
|
||||
@@ -338,6 +338,7 @@ func (obj *SvcRes) CheckApply(apply bool) (bool, error) {
|
||||
refresh = false // we did a stop, so a reload is not needed
|
||||
}
|
||||
|
||||
// XXX: use ctx here
|
||||
status := <-result
|
||||
if &status == nil {
|
||||
return false, fmt.Errorf("systemd service action result is nil")
|
||||
|
||||
Reference in New Issue
Block a user