mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-27 02:04:01 -04:00
command: move inspect to schedulers
This commit is contained in:
+1
-7
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/posener/complete"
|
||||
)
|
||||
|
||||
@@ -48,12 +47,7 @@ func (c *InspectCommand) RunContext(ctx context.Context, cla *InspectArgs) int {
|
||||
return ret
|
||||
}
|
||||
|
||||
// here we ignore init diags to allow unknown variables to be used
|
||||
_ = packerStarter.Initialize(packer.InitializeOptions{})
|
||||
|
||||
return packerStarter.InspectConfig(packer.InspectConfigOptions{
|
||||
Ui: c.Ui,
|
||||
})
|
||||
return NewScheduler(packerStarter, c.Ui, ctx).Inspect(cla)
|
||||
}
|
||||
|
||||
func (*InspectCommand) Help() string {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
type Scheduler interface {
|
||||
Build(*BuildArgs) int
|
||||
Validate(*ValidateArgs) int
|
||||
Inspect(*InspectArgs) int
|
||||
}
|
||||
|
||||
// NewScheduler returns a new scheduler for running commands with.
|
||||
|
||||
@@ -77,7 +77,13 @@ func (s *SequentialScheduler) prepare(skipDatasourcesExecution bool) hcl.Diagnos
|
||||
diags = diags.Extend(s.scheduler.PrepareBuilds())
|
||||
|
||||
return diags
|
||||
}
|
||||
|
||||
func (s *SequentialScheduler) Inspect(args *InspectArgs) int {
|
||||
s.prepare(false)
|
||||
return s.handler.InspectConfig(packer.InspectConfigOptions{
|
||||
Ui: s.ui,
|
||||
})
|
||||
}
|
||||
|
||||
func (s *SequentialScheduler) Validate(args *ValidateArgs) int {
|
||||
|
||||
Reference in New Issue
Block a user