mirror of
https://github.com/containers/podman.git
synced 2025-09-09 17:42:22 +08:00
Merge pull request #10595 from boaz0/closes_10539
Add podman-restart systemd unit file
This commit is contained in:
@ -702,7 +702,9 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
reports := []*entities.ContainerStartReport{}
|
||||
var exitCode = define.ExecErrorCodeGeneric
|
||||
containersNamesOrIds := namesOrIds
|
||||
all := options.All
|
||||
if len(options.Filters) > 0 {
|
||||
all = false
|
||||
filterFuncs := make([]libpod.ContainerFilter, 0, len(options.Filters))
|
||||
if len(options.Filters) > 0 {
|
||||
for k, v := range options.Filters {
|
||||
@ -719,6 +721,10 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
}
|
||||
containersNamesOrIds = []string{}
|
||||
for _, candidate := range candidates {
|
||||
if options.All {
|
||||
containersNamesOrIds = append(containersNamesOrIds, candidate.ID())
|
||||
continue
|
||||
}
|
||||
for _, nameOrID := range namesOrIds {
|
||||
if nameOrID == candidate.ID() || nameOrID == candidate.Name() {
|
||||
containersNamesOrIds = append(containersNamesOrIds, nameOrID)
|
||||
@ -726,8 +732,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctrs, rawInputs, err := getContainersAndInputByContext(options.All, options.Latest, containersNamesOrIds, ic.Libpod)
|
||||
ctrs, rawInputs, err := getContainersAndInputByContext(all, options.Latest, containersNamesOrIds, ic.Libpod)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -508,7 +508,9 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
reports := []*entities.ContainerStartReport{}
|
||||
var exitCode = define.ExecErrorCodeGeneric
|
||||
containersNamesOrIds := namesOrIds
|
||||
all := options.All
|
||||
if len(options.Filters) > 0 {
|
||||
all = false
|
||||
containersNamesOrIds = []string{}
|
||||
opts := new(containers.ListOptions).WithFilters(options.Filters).WithAll(true)
|
||||
candidates, listErr := containers.List(ic.ClientCtx, opts)
|
||||
@ -516,6 +518,10 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
return nil, listErr
|
||||
}
|
||||
for _, candidate := range candidates {
|
||||
if options.All {
|
||||
containersNamesOrIds = append(containersNamesOrIds, candidate.ID)
|
||||
continue
|
||||
}
|
||||
for _, nameOrID := range namesOrIds {
|
||||
if nameOrID == candidate.ID {
|
||||
containersNamesOrIds = append(containersNamesOrIds, nameOrID)
|
||||
@ -530,7 +536,7 @@ func (ic *ContainerEngine) ContainerStart(ctx context.Context, namesOrIds []stri
|
||||
}
|
||||
}
|
||||
}
|
||||
ctrs, err := getContainersByContext(ic.ClientCtx, options.All, false, containersNamesOrIds)
|
||||
ctrs, err := getContainersByContext(ic.ClientCtx, all, false, containersNamesOrIds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user