Skip to content

Commit

Permalink
(feat): Improve labelling code clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
lasith-kg committed Dec 16, 2023
1 parent e6f4b02 commit 262e52f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/layer/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ func (fdl *LabelDeviceLayer) Modify(c *config.Config) ([]action.Action, error) {
return nil, fmt.Errorf("🔴 %s: Can not label a device with no file system", bd.Name)
}
mode := c.GetMode(name)
a, err := fdl.deviceBackend.Label(bd, cd.Label)
// Labelling a device can potentially require unmounting it first
// Therefore, multiple actions may be returned: Label Actions (las)
las, err := fdl.deviceBackend.Label(bd, cd.Label)
if err != nil {
return nil, err
}
for i := range a {
a[i] = a[i].SetMode(mode)
actions = append(actions, a[i])
for _, la := range las {
actions = append(actions, la.SetMode(mode))
}
}
return actions, nil
Expand Down

0 comments on commit 262e52f

Please sign in to comment.