Update builtins to implement seed(s) function

This commit is contained in:
Chris Roberts 2021-10-13 11:40:36 -07:00 committed by Paul Hinze
parent 678ffa60dc
commit 661785771f
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
3 changed files with 21 additions and 0 deletions

View File

@ -50,13 +50,18 @@ func (c *Host) Execute(trm terminal.UI, project core.Project) int32 {
h, err := project.Host()
if err != nil {
trm.Output("ERROR: %s", err)
return 1
}
trm.Output("have host plugin to run against")
if r, err := h.HasCapability("dummy"); !r {
trm.Output("No dummy capability found (%s)", err)
return 1
}
trm.Output("host plugin has dummy capability to run")
result, err := h.Capability("dummy", trm, "test value")
if err != nil {
trm.Output("Error running capability: %s", err)

View File

@ -16,6 +16,14 @@ type AlwaysTrueHost struct {
config HostConfig
}
func (c *AlwaysTrueHost) Seed(args ...interface{}) error {
return nil
}
func (c *AlwaysTrueHost) Seeds() ([]interface{}, error) {
return nil, nil
}
// DetectFunc implements component.Host
func (h *AlwaysTrueHost) HostDetectFunc() interface{} {
return h.Detect

View File

@ -16,6 +16,14 @@ type AlwaysTrueGuest struct {
config GuestConfig
}
func (c *AlwaysTrueGuest) Seed(args ...interface{}) error {
return nil
}
func (c *AlwaysTrueGuest) Seeds() ([]interface{}, error) {
return nil, nil
}
// DetectFunc implements component.Guest
func (h *AlwaysTrueGuest) GuestDetectFunc() interface{} {
return h.Detect