Merge "Adding Bootstrap Event"

This commit is contained in:
Zuul 2020-11-06 00:01:01 +00:00 committed by Gerrit Code Review
commit ee120fde74
2 changed files with 34 additions and 0 deletions

View File

@ -37,6 +37,8 @@ const (
ClusterctlType
// IsogenType event emitted by Isogen executor
IsogenType
// BootstrapType event emitted by Bootstrap executor
BootstrapType
)
// Event holds all possible events that can be produced by airship
@ -48,6 +50,7 @@ type Event struct {
StatusPollerEvent statuspollerevent.Event
ClusterctlEvent ClusterctlEvent
IsogenEvent IsogenEvent
BootstrapEvent BootstrapEvent
}
// NewEvent create new event with timestamp
@ -120,3 +123,32 @@ func (e Event) WithIsogenEvent(concreteEvent IsogenEvent) Event {
e.IsogenEvent = concreteEvent
return e
}
// BootstrapOperation type
type BootstrapOperation int
const (
// BootstrapStart operation
BootstrapStart BootstrapOperation = iota
// BootstrapDryRun operation
BootstrapDryRun
// BootstrapValidation operation
BootstrapValidation
// BootstrapRun operation
BootstrapRun
// BootstrapEnd operation
BootstrapEnd
)
// BootstrapEvent needs to to track events in bootstrap executor
type BootstrapEvent struct {
Operation BootstrapOperation
Message string
}
// WithBootstrapEvent sets type and actual bootstrap event
func (e Event) WithBootstrapEvent(concreteEvent BootstrapEvent) Event {
e.Type = BootstrapType
e.BootstrapEvent = concreteEvent
return e
}

View File

@ -59,6 +59,8 @@ func (p *DefaultProcessor) Process(ch <-chan Event) error {
// Stringer interface or AsYAML for further processing.
// For now we print the event object as is
log.Printf("Received event: %v", e)
case BootstrapType:
log.Printf("%s", e.BootstrapEvent.Message)
case StatusPollerType:
log.Fatalf("Processing for status poller events are not yet implemented")
case WaitType: