diff --git a/pkg/httpserver/httpserver.go b/pkg/httpserver/httpserver.go index 13ae93906847fe066579aa2f725f73d31f2adb8d..5370e582c33b6dfb35c836b82906d5262a5f0ef6 100644 --- a/pkg/httpserver/httpserver.go +++ b/pkg/httpserver/httpserver.go @@ -48,8 +48,10 @@ type HTTPService struct { func NewHTTPService(port string) *HTTPService { return &HTTPService{ - Port: port, - FileCache: make(map[string][]byte), + Port: port, + FileCache: make(map[string][]byte), + HttpLastRequestTime: time.Now().Unix(), + Ch: make(chan struct{}, 1), } } diff --git a/pkg/infra/ipxe.go b/pkg/infra/ipxe.go index 7db532a35038369f36690d0f90e08278fc1a783f..9dd35f0f1e2a123693feab6d8e20f789943f2eeb 100644 --- a/pkg/infra/ipxe.go +++ b/pkg/infra/ipxe.go @@ -21,7 +21,6 @@ import ( "nestos-kubernetes-deployer/pkg/constants" "nestos-kubernetes-deployer/pkg/httpserver" "os" - "time" ) type IPXE struct { @@ -34,7 +33,6 @@ type IPXE struct { func (i *IPXE) deployHTTP(port string, dirPath string, filePath string) error { i.HTTPService.Port = port i.HTTPService.DirPath = dirPath - i.HTTPService.HttpLastRequestTime = time.Now().Unix() fileContent, err := os.ReadFile(filePath) if err != nil { @@ -46,7 +44,7 @@ func (i *IPXE) deployHTTP(port string, dirPath string, filePath string) error { } if err := i.HTTPService.Start(); err != nil { - return fmt.Errorf("error starting file service: %v", err) + return fmt.Errorf("error starting http service: %v", err) } return nil diff --git a/pkg/infra/pxe.go b/pkg/infra/pxe.go index 9eb512ef918eea34b7434fa89de54524d178ac2e..3fbd403e9b93cf345830e676f918ec948e67471f 100644 --- a/pkg/infra/pxe.go +++ b/pkg/infra/pxe.go @@ -17,10 +17,10 @@ limitations under the License. package infra import ( - "github.com/sirupsen/logrus" "nestos-kubernetes-deployer/pkg/httpserver" "nestos-kubernetes-deployer/pkg/tftpserver" - "time" + + "github.com/sirupsen/logrus" ) type PXE struct { @@ -35,8 +35,6 @@ type PXE struct { func (p *PXE) deployHTTP(port string, dirPath string) error { p.HTTPService.Port = port p.HTTPService.DirPath = dirPath - p.HTTPService.HttpLastRequestTime = time.Now().Unix() - p.HTTPService.Ch = make(chan struct{}, 1) if err := p.HTTPService.Start(); err != nil { return err }