зеркало из https://github.com/docker/compose-cli.git
Fix linter issues
Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Родитель
a4e54e9b5d
Коммит
e075df6f8f
22
azure/aci.go
22
azure/aci.go
|
@ -29,10 +29,10 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
func createACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) (c containerinstance.ContainerGroup, err error) {
|
||||
func createACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) error {
|
||||
containerGroupsClient, err := getContainerGroupsClient(aciContext.SubscriptionID)
|
||||
if err != nil {
|
||||
return c, errors.Wrapf(err, "cannot get container group client")
|
||||
return errors.Wrapf(err, "cannot get container group client")
|
||||
}
|
||||
|
||||
// Check if the container group already exists
|
||||
|
@ -40,13 +40,13 @@ func createACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||
if err != nil {
|
||||
if err, ok := err.(autorest.DetailedError); ok {
|
||||
if err.StatusCode != http.StatusNotFound {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return c, fmt.Errorf("container group %q already exists", *groupDefinition.Name)
|
||||
return fmt.Errorf("container group %q already exists", *groupDefinition.Name)
|
||||
}
|
||||
|
||||
future, err := containerGroupsClient.CreateOrUpdate(
|
||||
|
@ -57,16 +57,16 @@ func createACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||
)
|
||||
|
||||
if err != nil {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
|
||||
err = future.WaitForCompletionRef(ctx, containerGroupsClient.Client)
|
||||
if err != nil {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
containerGroup, err := future.Result(containerGroupsClient)
|
||||
if err != nil {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
|
||||
if len(*containerGroup.Containers) > 1 {
|
||||
|
@ -80,7 +80,7 @@ func createACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||
container := containers[0]
|
||||
response, err := execACIContainer(ctx, aciContext, "/bin/sh", *containerGroup.Name, *container.Name)
|
||||
if err != nil {
|
||||
return c, err
|
||||
return err
|
||||
}
|
||||
|
||||
if err = execCommands(
|
||||
|
@ -89,11 +89,11 @@ func createACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||
*response.Password,
|
||||
commands,
|
||||
); err != nil {
|
||||
return containerinstance.ContainerGroup{}, err
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return containerGroup, err
|
||||
return err
|
||||
}
|
||||
|
||||
func deleteACIContainerGroup(ctx context.Context, aciContext store.AciContext, containerGroupName string) (c containerinstance.ContainerGroup, err error) {
|
||||
|
|
|
@ -48,11 +48,11 @@ func New(ctx context.Context) (backend.Service, error) {
|
|||
containerGroupsClient := containerinstance.NewContainerGroupsClient(aciContext.SubscriptionID)
|
||||
containerGroupsClient.Authorizer = auth
|
||||
|
||||
return getAciApiService(containerGroupsClient, aciContext), nil
|
||||
return getAciAPIService(containerGroupsClient, aciContext), nil
|
||||
}
|
||||
|
||||
func getAciApiService(cgc containerinstance.ContainerGroupsClient, aciCtx store.AciContext) *aciApiService {
|
||||
return &aciApiService{
|
||||
func getAciAPIService(cgc containerinstance.ContainerGroupsClient, aciCtx store.AciContext) *aciAPIService {
|
||||
return &aciAPIService{
|
||||
container: aciContainerService{
|
||||
containerGroupsClient: cgc,
|
||||
ctx: aciCtx,
|
||||
|
@ -64,19 +64,19 @@ func getAciApiService(cgc containerinstance.ContainerGroupsClient, aciCtx store.
|
|||
}
|
||||
}
|
||||
|
||||
type aciApiService struct {
|
||||
type aciAPIService struct {
|
||||
container aciContainerService
|
||||
compose aciComposeService
|
||||
}
|
||||
|
||||
func (a *aciApiService) ContainerService() containers.Service {
|
||||
func (a *aciAPIService) ContainerService() containers.Service {
|
||||
return &aciContainerService{
|
||||
containerGroupsClient: a.container.containerGroupsClient,
|
||||
ctx: a.container.ctx,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *aciApiService) ComposeService() compose.Service {
|
||||
func (a *aciAPIService) ComposeService() compose.Service {
|
||||
return &aciComposeService{
|
||||
containerGroupsClient: a.compose.containerGroupsClient,
|
||||
ctx: a.compose.ctx,
|
||||
|
@ -152,8 +152,7 @@ func (cs *aciContainerService) Run(ctx context.Context, r containers.ContainerCo
|
|||
return err
|
||||
}
|
||||
|
||||
_, err = createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||
return err
|
||||
return createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||
}
|
||||
|
||||
func (cs *aciContainerService) Exec(ctx context.Context, name string, command string, reader io.Reader, writer io.Writer) error {
|
||||
|
@ -208,8 +207,7 @@ func (cs *aciComposeService) Up(ctx context.Context, opts compose.ProjectOptions
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||
return err
|
||||
return createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||
}
|
||||
|
||||
func (cs *aciComposeService) Down(ctx context.Context, opts compose.ProjectOptions) error {
|
||||
|
|
|
@ -29,7 +29,7 @@ var backends = struct {
|
|||
r []*registeredBackend
|
||||
}{}
|
||||
|
||||
// Aggregation of service interfaces
|
||||
// Service aggregates the service interfaces
|
||||
type Service interface {
|
||||
ContainerService() containers.Service
|
||||
ComposeService() compose.Service
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/docker/api/compose"
|
||||
)
|
||||
|
||||
// Command returns the compose command with its child commands
|
||||
func Command() *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
Short: "Docker Compose",
|
||||
|
|
Загрузка…
Ссылка в новой задаче