Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lxc_container: fix lxc argument when executing lxc command #5659

Merged
merged 1 commit into from
Dec 17, 2022

Conversation

lynxis
Copy link
Contributor

@lynxis lynxis commented Dec 5, 2022

SUMMARY

lxc_container fails when executing the lxc command (e.g. when creating a new container) because PR #5358 broke the module argument parsing. The resulting argument dict contained only the module argument name and the argument flag but not the value. E.g.

- lxc_container:
    template: debian

would result in the lxc command:

  • lxc template --template (current result)
  • lxc --template debian (while this is the correct line)

Fixes: 6f88426 ("lxc_container: minor refactor (#5358)")
Fixes #5578

CC: @russoz

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lxc_container

ADDITIONAL INFORMATION

To reproduce the issue create a container which doesn't exist before:

  - name: Create a started container
    community.general.lxc_container:
      name: some
      state: started
      template: template
      template_options: --dist debian --release bullseye --arch amd64

will execute
/usr/bin/lxc-create --name some --quiet template --template backing_store --bdev -- --dist debian --release bullseye --arch amd64

correct would be
/usr/bin/lxc-create --name some --quiet --template template --bdev dir -- --dist debian --release bullseye --arch amd64

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug cloud module module new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review labels Dec 5, 2022
@cloudnull
Copy link
Contributor

shipit!

Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-5 labels Dec 5, 2022
lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426 ("lxc_container: minor refactor (ansible-collections#5358)")
Fixes ansible-collections#5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Dec 16, 2022
@lynxis
Copy link
Contributor Author

lynxis commented Dec 17, 2022

Thanks for your contribution! Can you please add a changelog fragment? Thanks.

Done.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 17, 2022
@felixfontein felixfontein merged commit af53271 into ansible-collections:main Dec 17, 2022
@patchback
Copy link

patchback bot commented Dec 17, 2022

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/af53271c41f14c39696b1ac3f65b3163407ab18b/pr-5659

Backported as #5697

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 17, 2022
lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426 ("lxc_container: minor refactor (#5358)")
Fixes #5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(cherry picked from commit af53271)
@felixfontein
Copy link
Collaborator

@lynxis thanks for fixing this!
@cloudnull thanks for reviewing!

@patchback
Copy link

patchback bot commented Dec 17, 2022

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/af53271c41f14c39696b1ac3f65b3163407ab18b/pr-5659

Backported as #5698

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Dec 17, 2022
lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426 ("lxc_container: minor refactor (#5358)")
Fixes #5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(cherry picked from commit af53271)
felixfontein pushed a commit that referenced this pull request Dec 17, 2022
…t when executing lxc command (#5697)

lxc_container: fix lxc argument when executing lxc command (#5659)

lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426 ("lxc_container: minor refactor (#5358)")
Fixes #5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(cherry picked from commit af53271)

Co-authored-by: Alexander Couzens <lynxis@fe80.eu>
felixfontein pushed a commit that referenced this pull request Dec 17, 2022
…t when executing lxc command (#5698)

lxc_container: fix lxc argument when executing lxc command (#5659)

lxc_container fails when executing the lxc command (e.g. when creating
a new container) because PR#5358 broke the module argument
parsing. The resulting argument dict contained only the module argument name
and the argument flag but not the value. E.g.
```
- lxc_container:
    template: debian
```
would result in lxc command arguments `lxc template --template` instead of
`lxc --template debian`.

Fixes: 6f88426 ("lxc_container: minor refactor (#5358)")
Fixes #5578

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
(cherry picked from commit af53271)

Co-authored-by: Alexander Couzens <lynxis@fe80.eu>
@lynxis lynxis deleted the fix-lxc-container branch December 19, 2022 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug cloud module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lxc_container: lxc-create commandline yields unknown option error
4 participants