File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -58,19 +58,21 @@ func init() {
58
58
func InitializeBuiltInRunbooks () {
59
59
LoadBuiltInRunbooks (embeddedRunbooks )
60
60
if config .Envs .EPCC_RUNBOOK_DIRECTORY != "" {
61
- LoadRunbooksFromDirectory (config .Envs .EPCC_RUNBOOK_DIRECTORY )
61
+ if loadedRunbookCount := LoadRunbooksFromDirectory (config .Envs .EPCC_RUNBOOK_DIRECTORY ); loadedRunbookCount == 0 {
62
+ log .Warnf ("EPCC_RUNBOOK_DIRECTORY set as %s but no files found, runbooks should end in .epcc.yml" , config .Envs .EPCC_RUNBOOK_DIRECTORY )
63
+ }
62
64
}
63
-
64
65
}
65
66
66
- func LoadRunbooksFromDirectory (dir string ) {
67
+ func LoadRunbooksFromDirectory (dir string ) uint32 {
67
68
68
69
entries , err := os .ReadDir (dir )
69
70
if err != nil {
70
71
log .Warnf ("Could not read Runbooks from directory %s due to error: %v" , dir , err )
71
- return
72
+ return 0
72
73
}
73
74
75
+ count := uint32 (0 )
74
76
for _ , entry := range entries {
75
77
info , err := entry .Info ()
76
78
if err != nil {
@@ -95,11 +97,14 @@ func LoadRunbooksFromDirectory(dir string) {
95
97
log .Warnf ("Could not read Runbooks from file %s due to error: %v" , filename , err )
96
98
continue
97
99
}
100
+ count ++
98
101
} else {
99
102
log .Tracef ("File %s does not end in .epcc.yml, not parsing." , filename )
100
103
}
101
104
102
105
}
106
+
107
+ return count
103
108
}
104
109
105
110
func GetRunbookNames () []string {
You can’t perform that action at this time.
0 commit comments