mirror of
https://github.com/containers/podman.git
synced 2025-09-17 06:47:10 +08:00
inline some conditionals
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -445,7 +445,6 @@ func configHook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func loggingHook() {
|
func loggingHook() {
|
||||||
var found bool
|
|
||||||
if debug {
|
if debug {
|
||||||
if logLevel != defaultLogLevel {
|
if logLevel != defaultLogLevel {
|
||||||
fmt.Fprintf(os.Stderr, "Setting --log-level and --debug is not allowed\n")
|
fmt.Fprintf(os.Stderr, "Setting --log-level and --debug is not allowed\n")
|
||||||
@ -453,10 +452,8 @@ func loggingHook() {
|
|||||||
}
|
}
|
||||||
logLevel = "debug"
|
logLevel = "debug"
|
||||||
}
|
}
|
||||||
if slices.Contains(common.LogLevels, strings.ToLower(logLevel)) {
|
|
||||||
found = true
|
if !slices.Contains(common.LogLevels, strings.ToLower(logLevel)) {
|
||||||
}
|
|
||||||
if !found {
|
|
||||||
fmt.Fprintf(os.Stderr, "Log Level %q is not supported, choose from: %s\n", logLevel, strings.Join(common.LogLevels, ", "))
|
fmt.Fprintf(os.Stderr, "Log Level %q is not supported, choose from: %s\n", logLevel, strings.Join(common.LogLevels, ", "))
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai
|
|||||||
// Only include anonymous named volumes added by the user by
|
// Only include anonymous named volumes added by the user by
|
||||||
// default.
|
// default.
|
||||||
for _, v := range c.config.NamedVolumes {
|
for _, v := range c.config.NamedVolumes {
|
||||||
include := slices.Contains(c.config.UserVolumes, v.Dest)
|
if slices.Contains(c.config.UserVolumes, v.Dest) {
|
||||||
if include {
|
|
||||||
vol, err := c.runtime.GetVolume(v.Name)
|
vol, err := c.runtime.GetVolume(v.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("volume %s used in container %s has been removed: %w", v.Name, c.ID(), err)
|
return nil, fmt.Errorf("volume %s used in container %s has been removed: %w", v.Name, c.ID(), err)
|
||||||
|
@ -107,9 +107,7 @@ func validatePlugin(newPlugin *VolumePlugin) error {
|
|||||||
return fmt.Errorf("unmarshalling plugin %s activation response: %w", newPlugin.Name, err)
|
return fmt.Errorf("unmarshalling plugin %s activation response: %w", newPlugin.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
foundVolume := slices.Contains(respStruct.Implements, volumePluginType)
|
if !slices.Contains(respStruct.Implements, volumePluginType) {
|
||||||
|
|
||||||
if !foundVolume {
|
|
||||||
return fmt.Errorf("plugin %s does not implement volume plugin, instead provides %s: %w", newPlugin.Name, strings.Join(respStruct.Implements, ", "), ErrNotVolumePlugin)
|
return fmt.Errorf("plugin %s does not implement volume plugin, instead provides %s: %w", newPlugin.Name, strings.Join(respStruct.Implements, ", "), ErrNotVolumePlugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user