mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
Remove unnecessary error handling
A function in the reset code does not return an error. Simply removing the error variable and check for the condition (which was always false or nil) Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:

committed by
openshift-cherrypick-robot

parent
bba28688f7
commit
03b100563e
@ -47,15 +47,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func reset(_ *cobra.Command, _ []string) error {
|
func reset(_ *cobra.Command, _ []string) error {
|
||||||
var (
|
allProviders := provider2.GetAll()
|
||||||
err error
|
for _, p := range allProviders {
|
||||||
)
|
|
||||||
|
|
||||||
providers := provider2.GetAll()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
for _, p := range providers {
|
|
||||||
hasPerms := provider2.HasPermsForProvider(p.VMType())
|
hasPerms := provider2.HasPermsForProvider(p.VMType())
|
||||||
isInstalled, err := provider2.IsInstalled(p.VMType())
|
isInstalled, err := provider2.IsInstalled(p.VMType())
|
||||||
if !hasPerms && (isInstalled || err != nil) && !resetOptions.Force {
|
if !hasPerms && (isInstalled || err != nil) && !resetOptions.Force {
|
||||||
@ -65,7 +58,7 @@ func reset(_ *cobra.Command, _ []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !resetOptions.Force {
|
if !resetOptions.Force {
|
||||||
listResponse, err := shim.List(providers, machine.ListOptions{})
|
listResponse, err := shim.List(allProviders, machine.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -82,7 +75,7 @@ func reset(_ *cobra.Command, _ []string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return shim.Reset(providers, resetOptions)
|
return shim.Reset(allProviders, resetOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
func resetConfirmationMessage(listResponse []*machine.ListResponse) {
|
func resetConfirmationMessage(listResponse []*machine.ListResponse) {
|
||||||
|
Reference in New Issue
Block a user