Skip to content

Commit

Permalink
Remove docker driver from core (#2811)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Sep 1, 2020
1 parent 558c493 commit 4efdb48
Show file tree
Hide file tree
Showing 66 changed files with 152 additions and 1,864 deletions.
3 changes: 2 additions & 1 deletion molecule/command/create.py
Expand Up @@ -24,6 +24,7 @@
from molecule import logger
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)

Expand Down Expand Up @@ -109,7 +110,7 @@ def execute(self):
"--driver-name",
"-d",
type=click.Choice([str(s) for s in drivers()]),
help="Name of driver to use. (docker)",
help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
def create(ctx, scenario_name, driver_name): # pragma: no cover
"""Use the provisioner to start the instances."""
Expand Down
3 changes: 2 additions & 1 deletion molecule/command/destroy.py
Expand Up @@ -26,6 +26,7 @@
from molecule import logger, util
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
MOLECULE_PARALLEL = os.environ.get("MOLECULE_PARALLEL", False)
Expand Down Expand Up @@ -122,7 +123,7 @@ def execute(self):
"--driver-name",
"-d",
type=click.Choice([str(s) for s in drivers()]),
help="Name of driver to use. (docker)",
help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
@click.option(
"--all/--no-all",
Expand Down
5 changes: 3 additions & 2 deletions molecule/command/init/role.py
Expand Up @@ -28,6 +28,7 @@
from molecule import api, logger, util
from molecule.command import base as command_base
from molecule.command.init import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)

Expand Down Expand Up @@ -109,8 +110,8 @@ def execute(self):
"--driver-name",
"-d",
type=click.Choice([str(s) for s in api.drivers()]),
default="docker",
help="Name of driver to initialize. (docker)",
default=DEFAULT_DRIVER,
help=f"Name of driver to initialize. ({DEFAULT_DRIVER})",
)
@click.option(
"--lint-name",
Expand Down
5 changes: 3 additions & 2 deletions molecule/command/init/scenario.py
Expand Up @@ -26,6 +26,7 @@
from molecule import api, config, logger, util
from molecule.command import base as command_base
from molecule.command.init import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)

Expand Down Expand Up @@ -157,8 +158,8 @@ def _default_scenario_exists(ctx, param, value): # pragma: no cover
"--driver-name",
"-d",
type=click.Choice([str(s) for s in api.drivers()]),
default="docker",
help="Name of driver to initialize. (docker)",
default=DEFAULT_DRIVER,
help=f"Name of driver to initialize. ({DEFAULT_DRIVER})",
)
@click.option(
"--lint-name",
Expand Down
3 changes: 2 additions & 1 deletion molecule/command/prepare.py
Expand Up @@ -24,6 +24,7 @@
from molecule import logger
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)

Expand Down Expand Up @@ -118,7 +119,7 @@ def execute(self):
"--driver-name",
"-d",
type=click.Choice([str(s) for s in drivers()]),
help="Name of driver to use. (docker)",
help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
@click.option(
"--force/--no-force",
Expand Down
3 changes: 2 additions & 1 deletion molecule/command/test.py
Expand Up @@ -26,6 +26,7 @@
from molecule import logger, util
from molecule.api import drivers
from molecule.command import base
from molecule.config import DEFAULT_DRIVER

LOG = logger.get_logger(__name__)
MOLECULE_PARALLEL = os.environ.get("MOLECULE_PARALLEL", False)
Expand Down Expand Up @@ -108,7 +109,7 @@ def execute(self):
"--driver-name",
"-d",
type=click.Choice([str(s) for s in drivers()]),
help="Name of driver to use. (docker)",
help=f"Name of driver to use. ({DEFAULT_DRIVER})",
)
@click.option(
"--all/--no-all",
Expand Down
3 changes: 2 additions & 1 deletion molecule/config.py
Expand Up @@ -35,6 +35,7 @@
MOLECULE_DIRECTORY = "molecule"
MOLECULE_FILE = "molecule.yml"
MOLECULE_KEEP_STRING = "MOLECULE_"
DEFAULT_DRIVER = "delegated"


# https://stackoverflow.com/questions/16017397/injecting-function-call-after-init-with-decorator # noqa
Expand Down Expand Up @@ -338,7 +339,7 @@ def _get_defaults(self):
"env": {},
},
"driver": {
"name": "docker",
"name": "delegated",
"provider": {"name": None},
"options": {"managed": True},
"ssh_connection_options": [],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions molecule/data/validate-dockerfile.yml

This file was deleted.

21 changes: 11 additions & 10 deletions molecule/driver/delegated.py
Expand Up @@ -185,27 +185,28 @@ def ansible_connection_options(self, instance_name):
conn_dict["ansible_user"] = d.get("user")
conn_dict["ansible_host"] = d.get("address")
conn_dict["ansible_port"] = d.get("port")
conn_dict["ansible_connection"] = d.get("connection", "smart")
if d.get("become_method"):
if d.get("ansible_connection", None):
conn_dict["ansible_connection"] = d.get("connection", "smart")
if d.get("become_method", False):
conn_dict["ansible_become_method"] = d.get("become_method")
if d.get("become_pass"):
if d.get("become_pass", None):
conn_dict["ansible_become_pass"] = d.get("become_pass")
if d.get("identity_file"):
if d.get("identity_file", None):
conn_dict["ansible_private_key_file"] = d.get("identity_file")
conn_dict["ansible_ssh_common_args"] = " ".join(
self.ssh_connection_options
)
if d.get("password"):
if d.get("password", None):
conn_dict["ansible_password"] = d.get("password")
if d.get("winrm_transport"):
if d.get("winrm_transport", None):
conn_dict["ansible_winrm_transport"] = d.get("winrm_transport")
if d.get("winrm_cert_pem"):
if d.get("winrm_cert_pem", None):
conn_dict["ansible_winrm_cert_pem"] = d.get("winrm_cert_pem")
if d.get("winrm_cert_key_pem"):
if d.get("winrm_cert_key_pem", None):
conn_dict["ansible_winrm_cert_key_pem"] = d.get(
"winrm_cert_key_pem"
)
if d.get("winrm_server_cert_validation"):
if d.get("winrm_server_cert_validation", None):
conn_dict["ansible_winrm_server_cert_validation"] = d.get(
"winrm_server_cert_validation"
)
Expand All @@ -218,7 +219,7 @@ def ansible_connection_options(self, instance_name):
# Instance has yet to be provisioned , therefore the
# instance_config is not on disk.
return {}
return self.options["ansible_connection_options"]
return self.options.get("ansible_connection_options", {})

def _created(self):
if self.managed:
Expand Down

0 comments on commit 4efdb48

Please sign in to comment.