feature: baremetal tftp send customized files according to a file map (#13374)

Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
Jian Qiu
2022-02-03 21:21:17 +08:00
committed by GitHub
co-authored by Qiu Jian
parent 1aaa8ad1b0
commit 2c45629b50
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -51,6 +51,8 @@ type BaremetalOptions struct {
StatusProbeIntervalSeconds int `help:"interval to probe baremetal status, default is 60 seconds" default:"60"`
LogFetchIntervalSeconds int `help:"interval to fetch baremetal log, default is 900 seconds" default:"900"`
SendMetricsIntervalSeconds int `help:"interval to send baremetal metrics, default is 300 seconds" default:"300"`
TftpFileMap map[string]string `help:"map of filename to real file path for tftp"`
}
var (
+3
View File
@@ -123,6 +123,9 @@ func (h *TFTPHandler) sendFile(filename string, _ net.Addr) (io.ReadCloser, int6
}
func (h *TFTPHandler) getFilePath(fileName string) string {
if path, ok := options.Options.TftpFileMap[fileName]; ok {
return path
}
return filepath.Join(h.RootDir, fileName)
}