mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* lxc_container: fix the type of the 'container_config' parameter
* lxc_container: specify the type of elements in 'container_config'
* lxc_container: improve the documentation of the container_config option
* lxc_container: add changelogs fragment for PR 216
* lxc_container: update changelogs fragment for PR 216
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 9e51469e01
)
Co-authored-by: montag451 <montag451@laposte.net>
This commit is contained in:
parent
373df2ba68
commit
dbb145bc71
2 changed files with 7 additions and 9 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- lxc_container - fix the type of the ``container_config`` parameter. It is now processed as a list and not a string (https://github.com/ansible-collections/community.general/pull/216).
|
|
@ -143,6 +143,8 @@ options:
|
|||
container_config:
|
||||
description:
|
||||
- list of 'key=value' options to use when configuring a container.
|
||||
type: list
|
||||
elements: str
|
||||
requirements:
|
||||
- 'lxc >= 1.0 # OS package'
|
||||
- 'python >= 2.6 # OS Package'
|
||||
|
@ -701,14 +703,7 @@ class LxcContainerManagement(object):
|
|||
with open(container_config_file, 'rb') as f:
|
||||
container_config = to_text(f.read(), errors='surrogate_or_strict').splitlines(True)
|
||||
|
||||
# Note used ast literal_eval because AnsibleModule does not provide for
|
||||
# adequate dictionary parsing.
|
||||
# Issue: https://github.com/ansible/ansible/issues/7679
|
||||
# TODO(cloudnull) adjust import when issue has been resolved.
|
||||
import ast
|
||||
options_dict = ast.literal_eval(_container_config)
|
||||
parsed_options = [i.split('=', 1) for i in options_dict]
|
||||
|
||||
parsed_options = [i.split('=', 1) for i in _container_config]
|
||||
config_change = False
|
||||
for key, value in parsed_options:
|
||||
key = key.strip()
|
||||
|
@ -1695,7 +1690,8 @@ def main():
|
|||
type='str'
|
||||
),
|
||||
container_config=dict(
|
||||
type='str'
|
||||
type='list',
|
||||
elements='str'
|
||||
),
|
||||
container_log=dict(
|
||||
type='bool',
|
||||
|
|
Loading…
Reference in a new issue