Skip to content

Commit

Permalink
Merge pull request moby#14852 from rhatdan/relabel
Browse files Browse the repository at this point in the history
Rename internal field Relabel to Mode
  • Loading branch information
Jessie Frazelle committed Jul 27, 2015
2 parents 303345d + 4cb9479 commit 2f5dc43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,6 @@ type MountPoint struct {
Source string
Destination string
Driver string `json:",omitempty"`
Mode string // this is internally named `Relabel`
Mode string
RW bool
}
2 changes: 1 addition & 1 deletion daemon/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error
Source: m.Path(),
Destination: m.Destination,
Driver: m.Driver,
Mode: m.Relabel,
Mode: m.Mode,
RW: m.RW,
})
}
Expand Down
12 changes: 6 additions & 6 deletions daemon/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type mountPoint struct {
RW bool
Volume volume.Volume `json:"-"`
Source string
Relabel string
Mode string `json:"Relabel"` // Originally field was `Relabel`"
}

func (m *mountPoint) Setup() (string, error) {
Expand Down Expand Up @@ -94,8 +94,8 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (*
return nil, fmt.Errorf("invalid mode for volumes-from: %s", mode)
}
bind.RW = isRw
// Relabel will apply a SELinux label, if necessary
bind.Relabel = mode
// Mode field is used by SELinux to decide whether to apply label
bind.Mode = mode
default:
return nil, fmt.Errorf("Invalid volume specification: %s", spec)
}
Expand Down Expand Up @@ -226,12 +226,12 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
bind.Volume = v
bind.Source = v.Path()
// Since this is just a named volume and not a typical bind, set to shared mode `z`
if bind.Relabel == "" {
bind.Relabel = "z"
if bind.Mode == "" {
bind.Mode = "z"
}
}

if err := label.Relabel(bind.Source, container.MountLabel, bind.Relabel); err != nil {
if err := label.Relabel(bind.Source, container.MountLabel, bind.Mode); err != nil {
return err
}
binds[bind.Destination] = true
Expand Down

0 comments on commit 2f5dc43

Please sign in to comment.