Skip to content

Commit 4946cda

Browse files
authored
Resolves #439 - Add support for other embedded runbooks (#440)
1 parent 03f5a1b commit 4946cda

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

external/runbooks/runbooks.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var embeddedRunbooks embed.FS
1717

1818
var runbooks map[string]Runbook
1919

20+
var otherEmbeddedRunbooks []embed.FS
21+
2022
type Runbook struct {
2123

2224
// The name of the runbook
@@ -61,6 +63,13 @@ func Reset() {
6163

6264
func InitializeBuiltInRunbooks() {
6365
LoadBuiltInRunbooks(embeddedRunbooks)
66+
67+
log.Tracef("Processing other embedded runbooks")
68+
69+
for _, fs := range otherEmbeddedRunbooks {
70+
LoadBuiltInRunbooks(fs)
71+
}
72+
6473
env := config.GetEnv()
6574
if env.EPCC_RUNBOOK_DIRECTORY != "" {
6675
if loadedRunbookCount := LoadRunbooksFromDirectory(env.EPCC_RUNBOOK_DIRECTORY); loadedRunbookCount == 0 {
@@ -69,6 +78,10 @@ func InitializeBuiltInRunbooks() {
6978
}
7079
}
7180

81+
func AddOtherEmbeddedRunbooks(fs embed.FS) {
82+
otherEmbeddedRunbooks = append(otherEmbeddedRunbooks, fs)
83+
}
84+
7285
func LoadRunbooksFromDirectory(dir string) uint32 {
7386

7487
entries, err := os.ReadDir(dir)

0 commit comments

Comments
 (0)