Track scope when loading to use most specific scope for operation

This commit is contained in:
Chris Roberts 2021-05-25 13:27:44 -07:00 committed by Paul Hinze
parent c2d19f7a95
commit a46edc37f8
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -105,6 +105,8 @@ func (r *Runner) executeJob(
core.WithJobInfo(jobInfo),
}
var scope Runs
// Work backwards to setup the basis
var ref *vagrant_plugin_sdk.Ref_Basis
if job.Target != nil {
@ -123,6 +125,7 @@ func (r *Runner) executeJob(
}
defer b.Close()
scope = b
// Lets check for a project, and if we have one,
// load it up now
@ -136,6 +139,7 @@ func (r *Runner) executeJob(
return
}
defer p.Close()
scope = p
}
// Finally, if we have a target defined, load it up
@ -147,6 +151,7 @@ func (r *Runner) executeJob(
return
}
defer m.Close()
scope = m
}
// Execute the operation
@ -168,8 +173,8 @@ func (r *Runner) executeJob(
return r.executeInitOp(ctx, job, b)
case *vagrant_server.Job_Run:
log.Warn("running a run operation against project", "project", p, "job", job)
return r.executeRunOp(ctx, job, p)
log.Warn("running a run operation", "scope", scope, "job", job)
return r.executeRunOp(ctx, job, scope)
case *vagrant_server.Job_Auth:
return r.executeAuthOp(ctx, log, job, p)