mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-03 23:01:48 +00:00
Clean up modules according to last Ansible changes Set license for GPLv3 to avoid various possible issues
19 lines
718 B
Python
19 lines
718 B
Python
#!/usr/bin/python
|
|
# Copyright (c) 2020 Red Hat
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
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
|