Add docker compose v2 alias
This commit is contained in:
parent
cab43816a0
commit
2965d93ca8
3 changed files with 22 additions and 1 deletions
|
|
@ -488,7 +488,7 @@ func executeModuleWithMock(e *Executor, mock *MockSSHClient, host string, task *
|
|||
return moduleUFWWithClient(e, mock, args)
|
||||
|
||||
// Docker
|
||||
case "community.docker.docker_compose_v2", "ansible.builtin.docker_compose":
|
||||
case "community.docker.docker_compose_v2", "community.docker.docker_compose", "ansible.builtin.docker_compose":
|
||||
return moduleDockerComposeWithClient(e, mock, args)
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ func (e *Executor) executeModule(ctx context.Context, host string, client sshExe
|
|||
return e.moduleAuthorizedKey(ctx, client, args)
|
||||
case "community.docker.docker_compose":
|
||||
return e.moduleDockerCompose(ctx, client, args)
|
||||
case "community.docker.docker_compose_v2":
|
||||
return e.moduleDockerCompose(ctx, client, args)
|
||||
|
||||
default:
|
||||
// For unknown modules, try to execute as shell if it looks like a command
|
||||
|
|
|
|||
|
|
@ -1235,3 +1235,22 @@ func TestModulesAdv_ExecuteModuleWithMock_Good_DispatchDockerCompose(t *testing.
|
|||
require.NoError(t, err)
|
||||
assert.True(t, result.Changed)
|
||||
}
|
||||
|
||||
func TestModulesAdv_ExecuteModuleWithMock_Good_DispatchDockerComposeV2(t *testing.T) {
|
||||
e, mock := newTestExecutorWithMock("host1")
|
||||
mock.expectCommand(`docker compose up -d`, "Creating\n", "", 0)
|
||||
|
||||
task := &Task{
|
||||
Module: "community.docker.docker_compose_v2",
|
||||
Args: map[string]any{
|
||||
"project_src": "/opt/stack",
|
||||
"state": "present",
|
||||
},
|
||||
}
|
||||
|
||||
result, err := executeModuleWithMock(e, mock, "host1", task)
|
||||
|
||||
require.NoError(t, err)
|
||||
assert.True(t, result.Changed)
|
||||
assert.False(t, result.Failed)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue