mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07:00
Add podman_image and podman_image_info modules (#55103)
* Add podman_image and podman_image_info modules * Add integration test for podman_image_info * Change parameter names per feedback * Add integration tests for podman_image
This commit is contained in:
parent
e28d08a3c1
commit
c2be342ce1
14 changed files with 1150 additions and 0 deletions
19
lib/ansible/module_utils/podman/common.py
Normal file
19
lib/ansible/module_utils/podman/common.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2019 Ansible Project
|
||||
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
def run_podman_command(module, executable='podman', args=None, expected_rc=0, ignore_errors=False):
|
||||
if not isinstance(executable, list):
|
||||
command = [executable]
|
||||
if args is not None:
|
||||
command.extend(args)
|
||||
rc, out, err = module.run_command(command)
|
||||
if not ignore_errors and rc != expected_rc:
|
||||
module.fail_json(
|
||||
msg='Failed to run {command} {args}: {err}'.format(
|
||||
command=command, args=args, err=err))
|
||||
return rc, out, err
|
Loading…
Add table
Add a link
Reference in a new issue