-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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: minor refactor #5358
lxc_container: minor refactor #5358
Conversation
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Backport to stable-5: 💚 backport PR created✅ Backport PR branch: Backported as #5364 🤖 @patchback |
* lxc_container: minor refactor * add changelog fragment (cherry picked from commit 6f88426)
@russoz thanks for your contribution! |
* lxc_container: minor refactor * add changelog fragment
* lxc_container: minor refactor * add changelog fragment
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)") Closes ansible-collections#5578 Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
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>
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>
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>
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)
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)
…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>
…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>
SUMMARY
Minor refactor: mostly pythonisms, but removing the call to
os.path.expanduser()
in line 1361 (pre-change) because:source_dir
is passed as a parameter to the_create_tar()
method_create_tar()
is only called in one spot in the code, in line 1568 (post-change), inside the method_container_create_tar()
asself._create_tar(source_dir=work_dir)
work_dir
is defined in lines 1498-1502 (post-change) as:Therefore,
work_dir
will always be an absolute path, thereforeexpanduser()
is redundant.ISSUE TYPE
COMPONENT NAME
plugins/modules/cloud/lxc/lxc_container.py