From 7f643690c7535c2623c52809cd27b3231b9f0fa7 Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sat, 12 Oct 2019 21:08:20 +0200 Subject: [PATCH] docker modules: improve return value list documentation (#63145) * Improve type documentation. * Also improve return values. --- lib/ansible/modules/cloud/docker/docker_compose.py | 11 ++++++++--- lib/ansible/modules/cloud/docker/docker_host_info.py | 4 ++++ lib/ansible/modules/cloud/docker/docker_image_info.py | 1 + lib/ansible/modules/cloud/docker/docker_node_info.py | 1 + lib/ansible/modules/cloud/docker/docker_prune.py | 4 ++++ lib/ansible/modules/cloud/docker/docker_swarm.py | 5 +++-- lib/ansible/modules/cloud/docker/docker_swarm_info.py | 3 +++ .../modules/cloud/docker/docker_swarm_service.py | 1 + 8 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_compose.py b/lib/ansible/modules/cloud/docker/docker_compose.py index 5e284cea876..6ea6e1e9912 100644 --- a/lib/ansible/modules/cloud/docker/docker_compose.py +++ b/lib/ansible/modules/cloud/docker/docker_compose.py @@ -328,6 +328,7 @@ services: description: One or more commands to be executed in the container. returned: success type: list + elements: str example: ["postgres"] image: description: Name of the image from which the container was built. @@ -337,12 +338,13 @@ services: labels: description: Meta data assigned to the container. returned: success - type: complex + type: dict example: {...} networks: description: Contains a dictionary for each network to which the container is a member. returned: success - type: complex + type: list + elements: dict contains: IPAddress: description: The IP address assigned to the container. @@ -358,6 +360,7 @@ services: description: Aliases assigned to the container by the network. returned: success type: list + elements: str example: ['db'] globalIPv6: description: IPv6 address assigned to the container. @@ -373,6 +376,7 @@ services: description: List of container names to which this container is linked. returned: success type: list + elements: str example: null macAddress: description: Mac Address assigned to the virtual NIC. @@ -382,7 +386,7 @@ services: state: description: Information regarding the current disposition of the container. returned: success - type: complex + type: dict contains: running: description: Whether or not the container is up with a running process. @@ -436,6 +440,7 @@ actions: description: A descriptive name of the action to be performed on the service's containers. returned: always type: list + elements: str contains: id: description: the container's long ID diff --git a/lib/ansible/modules/cloud/docker/docker_host_info.py b/lib/ansible/modules/cloud/docker/docker_host_info.py index f3bcf796e74..7c7df66ec2a 100644 --- a/lib/ansible/modules/cloud/docker/docker_host_info.py +++ b/lib/ansible/modules/cloud/docker/docker_host_info.py @@ -155,6 +155,7 @@ volumes: See description for I(verbose_output). returned: When I(volumes) is C(yes) type: list + elements: dict networks: description: - List of dict objects containing the basic information about each network. @@ -162,6 +163,7 @@ networks: See description for I(verbose_output). returned: When I(networks) is C(yes) type: list + elements: dict containers: description: - List of dict objects containing the basic information about each container. @@ -169,6 +171,7 @@ containers: See description for I(verbose_output). returned: When I(containers) is C(yes) type: list + elements: dict images: description: - List of dict objects containing the basic information about each image. @@ -176,6 +179,7 @@ images: See description for I(verbose_output). returned: When I(images) is C(yes) type: list + elements: dict disk_usage: description: - Information on summary disk usage by images, containers and volumes on docker host diff --git a/lib/ansible/modules/cloud/docker/docker_image_info.py b/lib/ansible/modules/cloud/docker/docker_image_info.py index 7ffe47a0e55..f3c3b79ccb3 100644 --- a/lib/ansible/modules/cloud/docker/docker_image_info.py +++ b/lib/ansible/modules/cloud/docker/docker_image_info.py @@ -79,6 +79,7 @@ images: - The list only contains inspection results of images existing locally. returned: always type: list + elements: dict sample: [ { "Architecture": "amd64", diff --git a/lib/ansible/modules/cloud/docker/docker_node_info.py b/lib/ansible/modules/cloud/docker/docker_node_info.py index b9094c9f16c..63791abf8f6 100644 --- a/lib/ansible/modules/cloud/docker/docker_node_info.py +++ b/lib/ansible/modules/cloud/docker/docker_node_info.py @@ -86,6 +86,7 @@ nodes: managers and nodes that are unreachable. returned: always type: list + elements: dict ''' import traceback diff --git a/lib/ansible/modules/cloud/docker/docker_prune.py b/lib/ansible/modules/cloud/docker/docker_prune.py index 32f0db7658d..d7028015b53 100644 --- a/lib/ansible/modules/cloud/docker/docker_prune.py +++ b/lib/ansible/modules/cloud/docker/docker_prune.py @@ -124,6 +124,7 @@ containers: - List of IDs of deleted containers. returned: I(containers) is C(true) type: list + elements: str sample: '[]' containers_space_reclaimed: description: @@ -138,6 +139,7 @@ images: - List of IDs of deleted images. returned: I(images) is C(true) type: list + elements: str sample: '[]' images_space_reclaimed: description: @@ -152,6 +154,7 @@ networks: - List of IDs of deleted networks. returned: I(networks) is C(true) type: list + elements: str sample: '[]' # volumes @@ -160,6 +163,7 @@ volumes: - List of IDs of deleted volumes. returned: I(volumes) is C(true) type: list + elements: str sample: '[]' volumes_space_reclaimed: description: diff --git a/lib/ansible/modules/cloud/docker/docker_swarm.py b/lib/ansible/modules/cloud/docker/docker_swarm.py index 7886aeb5aa1..304c2b12b85 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm.py @@ -236,12 +236,12 @@ RETURN = ''' swarm_facts: description: Informations about swarm. returned: success - type: complex + type: dict contains: JoinTokens: description: Tokens to connect to the Swarm. returned: success - type: complex + type: dict contains: Worker: description: Token to create a new *worker* node @@ -264,6 +264,7 @@ actions: description: Provides the actions done on the swarm. returned: when action failed. type: list + elements: str example: "['This cluster is already a swarm cluster']" ''' diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_info.py b/lib/ansible/modules/cloud/docker/docker_swarm_info.py index 6a82d025e17..f82ce8f48d7 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm_info.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm_info.py @@ -175,6 +175,7 @@ nodes: See description for I(verbose_output). returned: When I(nodes) is C(yes) type: list + elements: dict services: description: - List of dict objects containing the basic information about each volume. @@ -182,6 +183,7 @@ services: See description for I(verbose_output). returned: When I(services) is C(yes) type: list + elements: dict tasks: description: - List of dict objects containing the basic information about each volume. @@ -189,6 +191,7 @@ tasks: See description for I(verbose_output). returned: When I(tasks) is C(yes) type: list + elements: dict ''' diff --git a/lib/ansible/modules/cloud/docker/docker_swarm_service.py b/lib/ansible/modules/cloud/docker/docker_swarm_service.py index 7e43242b938..b3cd2b91c1b 100644 --- a/lib/ansible/modules/cloud/docker/docker_swarm_service.py +++ b/lib/ansible/modules/cloud/docker/docker_swarm_service.py @@ -901,6 +901,7 @@ changes: description: - List of changed service attributes if a service has been altered, [] otherwise. type: list + elements: str sample: ['container_labels', 'replicas'] rebuilt: returned: always