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

Remove docker driver from core #2811

Merged
merged 1 commit into from
Sep 1, 2020
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
3 changes: 2 additions & 1 deletion molecule/command/create.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading