Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid running docker tests with podman-docker #2457

Merged
merged 1 commit into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions molecule/command/init/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,14 @@
# DEALINGS IN THE SOFTWARE.

import os
import sys
import click
import subprocess
from molecule import api
from molecule import logger
from molecule import util
from molecule.command import base as command_base
from molecule.command.init import base

if os.name == 'posix' and sys.version_info[0] < 3:
import subprocess32 as subprocess
else:
import subprocess


LOG = logger.get_logger(__name__)

Expand Down Expand Up @@ -77,9 +72,7 @@ def execute(self):

try:
cmd = ["ansible-galaxy", "init", "-v", "--offline", role_name]
subprocess.check_output(
cmd, stderr=subprocess.STDOUT, universal_newlines=True
)
util.check_output(cmd, stderr=subprocess.STDOUT, universal_newlines=True)
except Exception as e:
util.sysexit_with_message(
"Galaxy failed to create role: %s: %s" % (e, e.output)
Expand Down
18 changes: 17 additions & 1 deletion molecule/test/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import pexpect
import pytest
import sh
from subprocess import PIPE

from molecule import logger
from molecule import util
Expand Down Expand Up @@ -250,7 +251,22 @@ def get_virtualbox_executable():

@pytest.helpers.register
def supports_docker():
return get_docker_executable()
docker = get_docker_executable()
if docker:
result = util.run([docker, "info"], stdout=PIPE, universal_newlines=True)
if result.returncode != 0:
LOG.error(
"Error %s returned from `docker info`: %s",
result.returncode,
result.stdout,
)
return False
if "BuildahVersion" in result.stdout:
LOG.error(
"podman-docker is unsupported, see https://github.com/ansible/molecule/issues/2456"
)
return False
return True


def min_ansible(version):
Expand Down
7 changes: 7 additions & 0 deletions molecule/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
import re
import sys

try:
from subprocess import check_output # noqa 401
from subprocess import run # noqa 401
except ImportError:
from subprocess32 import check_output # noqa 401
from subprocess32 import run # noqa 401

try:
from collections.abc import Mapping
except ImportError: # Python 2 compatibility
Expand Down