mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
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:
@@ -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 (
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user