mirror of
https://github.com/qdm12/gluetun.git
synced 2026-05-06 20:10:11 +02:00
Use ErrKernelModuleMissing when missing kernel module string is detected
This commit is contained in:
@@ -76,6 +76,9 @@ func (c *Config) runIP6tablesInstructionNoSave(ctx context.Context, instruction
|
|||||||
cmd := exec.CommandContext(ctx, c.ip6Tables, flags...) // #nosec G204
|
cmd := exec.CommandContext(ctx, c.ip6Tables, flags...) // #nosec G204
|
||||||
c.logger.Debug(cmd.String())
|
c.logger.Debug(cmd.String())
|
||||||
if output, err := c.runner.Run(cmd); err != nil {
|
if output, err := c.runner.Run(cmd); err != nil {
|
||||||
|
if strings.Contains(output, "missing kernel module") {
|
||||||
|
err = ErrKernelModuleMissing
|
||||||
|
}
|
||||||
return fmt.Errorf("command failed: \"%s %s\": %s: %w",
|
return fmt.Errorf("command failed: \"%s %s\": %s: %w",
|
||||||
c.ip6Tables, instruction, output, err)
|
c.ip6Tables, instruction, output, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ func (c *Config) runIptablesInstructionNoSave(ctx context.Context, instruction s
|
|||||||
cmd := exec.CommandContext(ctx, c.ipTables, flags...) // #nosec G204
|
cmd := exec.CommandContext(ctx, c.ipTables, flags...) // #nosec G204
|
||||||
c.logger.Debug(cmd.String())
|
c.logger.Debug(cmd.String())
|
||||||
if output, err := c.runner.Run(cmd); err != nil {
|
if output, err := c.runner.Run(cmd); err != nil {
|
||||||
|
if strings.Contains(output, "missing kernel module") {
|
||||||
|
err = ErrKernelModuleMissing
|
||||||
|
}
|
||||||
return fmt.Errorf("command failed: \"%s %s\": %s: %w",
|
return fmt.Errorf("command failed: \"%s %s\": %s: %w",
|
||||||
c.ipTables, instruction, output, err)
|
c.ipTables, instruction, output, err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user