Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions internal/orchestrator/provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,39 +236,39 @@ func generateMainComposeFile(
ports[fmt.Sprintf("%s:%s", p, p)] = struct{}{}
}

// 2. Collect all the required device classes
if len(idxBrick.RequiredDevices) > 0 {
for _, deviceClass := range idxBrick.RequiredDevices {
requiredDeviceClasses[deviceClass] = true
}
}

// The following code is needed only if the brick requires a container.
// In case it doesn't we just skip to the next one.
if !idxBrick.RequireContainer {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required devices was loading after checking if bricks requires a container.
So, required devices are not loaded in case of bricks without a container

continue
}

// 2. Retrieve the brick_compose.yaml file.
// 3. Retrieve the brick_compose.yaml file.
composeFilePath, err := staticStore.GetBrickComposeFilePathFromID(brick.ID)
if err != nil {
slog.Error("brick compose id not valid", slog.String("error", err.Error()), slog.String("brick_id", brick.ID))
continue
}

// 3. Retrieve the compose services names.
// 4. Retrieve the compose services names.
svcs, err := extractServicesFromComposeFile(composeFilePath)
if err != nil {
slog.Error("loading brick_compose", slog.String("brick_id", brick.ID), slog.String("path", composeFilePath.String()), slog.Any("error", err))
continue
}

// 4. Retrieve the required devices that we have to mount
// 5. Retrieve the required devices that we have to mount
slog.Debug("Brick config", slog.Bool("mount_devices_into_container", idxBrick.MountDevicesIntoContainer), slog.Any("ports", ports), slog.Any("required_devices", idxBrick.RequiredDevices))
if idxBrick.MountDevicesIntoContainer {
servicesThatRequireDevices = slices.AppendSeq(servicesThatRequireDevices, maps.Keys(svcs))
}

// 5. Collect all the required device classes
if len(idxBrick.RequiredDevices) > 0 {
for _, deviceClass := range idxBrick.RequiredDevices {
requiredDeviceClasses[deviceClass] = true
}
}

composeFiles.Add(composeFilePath)
maps.Insert(services, maps.All(svcs))
}
Expand Down