Skip to content

Commit 9d6a1b3

Browse files
committed
Update examples for podman_container_exec
Signed-off-by: nishipy <[email protected]>
1 parent dd1fa67 commit 9d6a1b3

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

plugins/modules/podman_container_exec.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
# Copyright (c) 2023, Takuya Nishimura <@nishipy>
55
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
66
from __future__ import absolute_import, division, print_function
7+
from ansible_collections.containers.podman.plugins.module_utils.podman.common import run_podman_command
8+
from ansible.module_utils.basic import AnsibleModule
9+
from ansible.module_utils._text import to_text
10+
from ansible.module_utils.six import string_types
11+
import shlex
712
__metaclass__ = type
813

914
DOCUMENTATION = r'''
@@ -67,24 +72,24 @@
6772

6873
EXAMPLES = r'''
6974
- name: Execute a command with workdir
70-
containers.podman.podman_container_exec:
75+
containers.podman.podman_container_exec:
7176
name: ubi8
7277
command: "cat redhat-release"
7378
workdir: /etc
7479
7580
- name: Execute a command with a list of args and enviroment variables
76-
containers.podman.podman_container_exec:
81+
containers.podman.podman_container_exec:
7782
name: test_container
7883
argv:
79-
- /bin/sh
80-
- -c
81-
- echo $HELLO $BYE
84+
- /bin/sh
85+
- -c
86+
- echo $HELLO $BYE
8287
env:
83-
HELLO: hello world
84-
BYE: goodbye world
88+
HELLO: hello world
89+
BYE: goodbye world
8590
8691
- name: Execute command in background by using detach
87-
containers.podman.podman_container_exec:
92+
containers.podman.podman_container_exec:
8893
name: detach_container
8994
command: "cat redhat-release"
9095
detach: true
@@ -115,12 +120,6 @@
115120
- The ID of the exec session.
116121
'''
117122

118-
import shlex
119-
from ansible.module_utils.six import string_types
120-
from ansible.module_utils._text import to_text
121-
from ansible.module_utils.basic import AnsibleModule
122-
from ansible_collections.containers.podman.plugins.module_utils.podman.common import run_podman_command
123-
124123

125124
def run_container_exec(module: AnsibleModule) -> dict:
126125
'''

0 commit comments

Comments
 (0)