Skip to content

Commit

Permalink
Resolves #439 - Add support for other embedded runbooks (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-r-west authored Jan 8, 2024
1 parent 03f5a1b commit 4946cda
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions external/runbooks/runbooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ var embeddedRunbooks embed.FS

var runbooks map[string]Runbook

var otherEmbeddedRunbooks []embed.FS

type Runbook struct {

// The name of the runbook
Expand Down Expand Up @@ -61,6 +63,13 @@ func Reset() {

func InitializeBuiltInRunbooks() {
LoadBuiltInRunbooks(embeddedRunbooks)

log.Tracef("Processing other embedded runbooks")

for _, fs := range otherEmbeddedRunbooks {
LoadBuiltInRunbooks(fs)
}

env := config.GetEnv()
if env.EPCC_RUNBOOK_DIRECTORY != "" {
if loadedRunbookCount := LoadRunbooksFromDirectory(env.EPCC_RUNBOOK_DIRECTORY); loadedRunbookCount == 0 {
Expand All @@ -69,6 +78,10 @@ func InitializeBuiltInRunbooks() {
}
}

func AddOtherEmbeddedRunbooks(fs embed.FS) {
otherEmbeddedRunbooks = append(otherEmbeddedRunbooks, fs)
}

func LoadRunbooksFromDirectory(dir string) uint32 {

entries, err := os.ReadDir(dir)
Expand Down

0 comments on commit 4946cda

Please sign in to comment.