style: rename DeniedHostGidsStr to reflect refactor

This commit is contained in:
Juanadelacuesta
2024-10-30 15:22:50 +01:00
parent a90eda628d
commit a86e951f03
6 changed files with 14 additions and 14 deletions

View File

@@ -167,8 +167,8 @@ type Config struct {
// running on this node.
AllowCaps []string `codec:"allow_caps"`
DeniedHostUidsStr string `codec:"denied_host_uids"`
DeniedHostGidsStr string `codec:"denied_host_gids"`
DeniedHostUids string `codec:"denied_host_uids"`
DeniedHostGids string `codec:"denied_host_gids"`
}
func (c *Config) validate() error {
@@ -312,7 +312,7 @@ func (d *Driver) SetConfig(cfg *base.Config) error {
}
if d.userIDValidator == nil {
idValidator, err := validators.NewValidator(d.logger, config.DeniedHostUidsStr, config.DeniedHostGidsStr)
idValidator, err := validators.NewValidator(d.logger, config.DeniedHostUids, config.DeniedHostGids)
if err != nil {
return fmt.Errorf("unable to start validator: %w", err)
}

View File

@@ -881,11 +881,11 @@ func TestDriver_Config_setDeniedIds(t *testing.T) {
defer harness.Kill()
config := &Config{
NoPivotRoot: false,
DefaultModePID: executor.IsolationModePrivate,
DefaultModeIPC: executor.IsolationModePrivate,
DeniedHostUidsStr: tc.uidRanges,
DeniedHostGidsStr: tc.gidRanges,
NoPivotRoot: false,
DefaultModePID: executor.IsolationModePrivate,
DefaultModeIPC: executor.IsolationModePrivate,
DeniedHostUids: tc.uidRanges,
DeniedHostGids: tc.gidRanges,
}
var data []byte

View File

@@ -150,8 +150,8 @@ type Config struct {
// Enabled is set to true to enable the raw_exec driver
Enabled bool `codec:"enabled"`
DeniedHostUidsStr string `codec:"denied_host_uids"`
DeniedHostGidsStr string `codec:"denied_host_gids"`
DeniedHostUids string `codec:"denied_host_uids"`
DeniedHostGids string `codec:"denied_host_gids"`
}
// TaskConfig is the driver configuration of a task within a job
@@ -215,7 +215,7 @@ func (d *Driver) SetConfig(cfg *base.Config) error {
}
if d.userIDValidator == nil {
idValidator, err := validators.NewValidator(d.logger, config.DeniedHostUidsStr, config.DeniedHostGidsStr)
idValidator, err := validators.NewValidator(d.logger, config.DeniedHostUids, config.DeniedHostGids)
if err != nil {
return fmt.Errorf("unable to start validator: %w", err)
}

View File

@@ -135,7 +135,7 @@ func TestRawExecDriver_SetConfig(t *testing.T) {
// Turns on uid/gid restrictions, and sets the range to a bad value and
// force the recreation of the validator.
d.(*Driver).userIDValidator = nil
config.DeniedHostUidsStr = "100-1"
config.DeniedHostUids = "100-1"
data = []byte{}
must.NoError(t, basePlug.MsgPackEncode(&data, config))

View File

@@ -558,8 +558,8 @@ func TestRawExec_Validate(t *testing.T) {
allowAll := ""
denyCurrent := current.Uid
configAllowCurrent := Config{DeniedHostUidsStr: allowAll}
configDenyCurrent := Config{DeniedHostUidsStr: denyCurrent}
configAllowCurrent := Config{DeniedHostUids: allowAll}
configDenyCurrent := Config{DeniedHostUids: denyCurrent}
driverConfigNoUserSpecified := drivers.TaskConfig{}
driverTaskConfig := drivers.TaskConfig{User: current.Name}