-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5863 from vrothberg/v2-fix-rmi
podman rmi: refactor logic
- Loading branch information
Showing
34 changed files
with
423 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ linters: | |
- misspell | ||
- prealloc | ||
- unparam | ||
- nakedret | ||
linters-settings: | ||
errcheck: | ||
check-blank: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// +build ABISupport | ||
|
||
package system | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"strings" | ||
|
||
api "github.com/containers/libpod/pkg/api/server" | ||
"github.com/containers/libpod/pkg/domain/entities" | ||
"github.com/containers/libpod/pkg/domain/infra" | ||
"github.com/pkg/errors" | ||
"github.com/sirupsen/logrus" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entities.PodmanConfig) error { | ||
var ( | ||
listener *net.Listener | ||
err error | ||
) | ||
|
||
if opts.URI != "" { | ||
fields := strings.Split(opts.URI, ":") | ||
if len(fields) == 1 { | ||
return errors.Errorf("%s is an invalid socket destination", opts.URI) | ||
} | ||
address := strings.Join(fields[1:], ":") | ||
l, err := net.Listen(fields[0], address) | ||
if err != nil { | ||
return errors.Wrapf(err, "unable to create socket %s", opts.URI) | ||
} | ||
listener = &l | ||
} | ||
|
||
rt, err := infra.GetRuntime(context.Background(), flags, cfg) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
server, err := api.NewServerWithSettings(rt, opts.Timeout, listener) | ||
if err != nil { | ||
return err | ||
} | ||
defer func() { | ||
if err := server.Shutdown(); err != nil { | ||
logrus.Warnf("Error when stopping API service: %s", err) | ||
} | ||
}() | ||
|
||
err = server.Serve() | ||
if listener != nil { | ||
_ = (*listener).Close() | ||
} | ||
return err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// +build !ABISupport | ||
|
||
package system | ||
|
||
import ( | ||
"errors" | ||
|
||
"github.com/containers/libpod/pkg/domain/entities" | ||
"github.com/spf13/pflag" | ||
) | ||
|
||
func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entities.PodmanConfig) error { | ||
return errors.New("not supported") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.