Skip to content

Commit

Permalink
fix: correct field name references in ISO configuration handling
Browse files Browse the repository at this point in the history
  • Loading branch information
PlusOne committed Dec 31, 2024
1 parent eb42034 commit 831bd25
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ func validateConfig(conf *Config) error {
if conf.ISO.Size == "" {
return fmt.Errorf("iso.size must be set when ISO is enabled")
}
if conf.ISO.MountPoint == "" {
if conf.ISO.MountPoint == "" { // Corrected field name
return fmt.Errorf("iso.mountPoint must be set when ISO is enabled")
}
if conf.ISO.Charset == "" {
Expand Down Expand Up @@ -2694,25 +2694,25 @@ func UnmountISOContainer(mountPoint string) error {
}

func handleISOContainer(absFilename string) error {
isoPath := filepath.Join(conf.ISO.MountPoint, "container.iso")
isoPath := filepath.Join(conf.ISO.MountPoint, "container.iso") // Corrected field name

err := CreateISOContainer([]string{absFilename}, isoPath, conf.ISO.Size, conf.ISO.Charset)
if err != nil {
isoCreationErrorsTotal.Inc()
return fmt.Errorf("failed to create ISO container: %w", err)
}

if err := os.MkdirAll(conf.ISO.MountPoint, os.ModePerm); err != nil {
if err := os.MkdirAll(conf.ISO.MountPoint, os.ModePerm); err != nil { // Corrected field name
return fmt.Errorf("failed to create mount point: %w", err)
}

err = MountISOContainer(isoPath, conf.ISO.MountPoint)
err = MountISOContainer(isoPath, conf.ISO.MountPoint) // Corrected field name
if err != nil {
isoMountErrorsTotal.Inc()
return fmt.Errorf("failed to mount ISO container: %w", err)
}

err = UnmountISOContainer(conf.ISO.MountPoint)
err = UnmountISOContainer(conf.ISO.MountPoint) // Corrected field name
if err != nil {
return fmt.Errorf("failed to unmount ISO: %w", err)
}
Expand Down Expand Up @@ -2824,14 +2824,14 @@ func precacheStoragePath(dir string) error {
// Step 5: Implement monitorDirectoryChanges function
func monitorDirectoryChanges(dir string) {
watcher, err := fsnotify.NewWatcher()
if err != nil {
if (err != nil) {
log.Error("Failed to create directory watcher:", err)
return
}
defer watcher.Close()

err = watcher.Add(dir)
if err != nil {
if (err != nil) {
log.Error("Failed to add directory to watcher:", err)
return
}
Expand Down

0 comments on commit 831bd25

Please sign in to comment.