From 7b1465e1e6cabc817a759ac93503c47d0b82766c Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Wed, 25 Sep 2019 10:30:05 +0100 Subject: [PATCH] Removed LXC and LXD providers Based on popularity survey which was also popularized on the mainling list, these providers are not really used. If there is enough interest for having them it it is possible to implement them as external plugins. Reference: https://github.com/pycontribs/pytest-molecule/issues/41 Signed-off-by: Sorin Sbarnea --- .travis.yml | 7 - CHANGELOG.rst | 1 + Dockerfile | 2 +- docs/configuration.rst | 12 -- .../molecule.yml | 4 - .../scenario/driver/lxc/cookiecutter.json | 5 - .../INSTALL.rst | 33 ----- .../{{cookiecutter.scenario_name}}/create.yml | 21 --- .../destroy.yml | 14 -- .../playbook.yml | 7 - .../scenario/driver/lxd/cookiecutter.json | 5 - .../INSTALL.rst | 14 -- .../playbook.yml | 7 - molecule/driver/lxc.py | 91 ------------- molecule/driver/lxd.py | 112 ---------------- molecule/model/schema_v2.py | 36 ----- .../ansible/playbooks/lxd/create.yml | 33 ----- .../ansible/playbooks/lxd/destroy.yml | 20 --- .../ansible/playbooks/lxd/prepare.yml | 29 ---- molecule/test/functional/conftest.py | 38 ------ molecule/test/functional/test_command.py | 86 ------------ .../test/resources/playbooks/lxc/create.yml | 19 --- .../test/resources/playbooks/lxc/destroy.yml | 12 -- .../test/resources/playbooks/lxd/create.yml | 30 ----- .../test/resources/playbooks/lxd/destroy.yml | 17 --- .../driver/lxc/molecule/default/molecule.yml | 29 ---- .../driver/lxc/molecule/default/playbook.yml | 6 - .../molecule/default/tests/test_default.py | 29 ---- .../lxc/molecule/multi-node/molecule.yml | 36 ----- .../lxc/molecule/multi-node/playbook.yml | 24 ---- .../molecule/multi-node/tests/test_default.py | 31 ----- .../driver/lxd/molecule/default/molecule.yml | 29 ---- .../driver/lxd/molecule/default/playbook.yml | 6 - .../molecule/default/tests/test_default.py | 10 -- .../lxd/molecule/multi-node/molecule.yml | 36 ----- .../lxd/molecule/multi-node/playbook.yml | 24 ---- .../molecule/multi-node/tests/test_default.py | 31 ----- .../test/unit/cookiecutter/test_molecule.py | 2 - molecule/test/unit/driver/test_lxc.py | 126 ------------------ molecule/test/unit/driver/test_lxd.py | 126 ------------------ .../test/unit/model/v2/test_driver_section.py | 12 -- .../unit/model/v2/test_platforms_section.py | 100 -------------- molecule/test/unit/test_config.py | 10 -- setup.cfg | 4 - tox.ini | 1 - 45 files changed, 2 insertions(+), 1325 deletions(-) delete mode 100644 molecule/cookiecutter/scenario/driver/lxc/cookiecutter.json delete mode 100644 molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst delete mode 100644 molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml delete mode 100644 molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml delete mode 100644 molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml delete mode 100644 molecule/cookiecutter/scenario/driver/lxd/cookiecutter.json delete mode 100644 molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst delete mode 100644 molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml delete mode 100644 molecule/driver/lxc.py delete mode 100644 molecule/driver/lxd.py delete mode 100644 molecule/provisioner/ansible/playbooks/lxd/create.yml delete mode 100644 molecule/provisioner/ansible/playbooks/lxd/destroy.yml delete mode 100644 molecule/provisioner/ansible/playbooks/lxd/prepare.yml delete mode 100644 molecule/test/resources/playbooks/lxc/create.yml delete mode 100644 molecule/test/resources/playbooks/lxc/destroy.yml delete mode 100644 molecule/test/resources/playbooks/lxd/create.yml delete mode 100644 molecule/test/resources/playbooks/lxd/destroy.yml delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/default/molecule.yml delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/default/playbook.yml delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/default/tests/test_default.py delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/multi-node/molecule.yml delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/multi-node/playbook.yml delete mode 100644 molecule/test/scenarios/driver/lxc/molecule/multi-node/tests/test_default.py delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/default/molecule.yml delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/default/playbook.yml delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/default/tests/test_default.py delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/multi-node/molecule.yml delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/multi-node/playbook.yml delete mode 100644 molecule/test/scenarios/driver/lxd/molecule/multi-node/tests/test_default.py delete mode 100644 molecule/test/unit/driver/test_lxc.py delete mode 100644 molecule/test/unit/driver/test_lxd.py diff --git a/.travis.yml b/.travis.yml index 56de1d5cb..3a6ae5ba9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -348,13 +348,6 @@ jobs: <<: *deploy-step server: https://test.pypi.org/legacy/ -addons: - apt: - packages: - - lxc - - lxc-dev - - lxd - - lxd-client before_install: - pip install tox-tags script: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 58c01c8b2..b8dbb9fe7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ History Unreleased ========== +* MAJOR: Removed LXC and LXD providers * Supported Ansible versions are now 2.9, 2.8, 2.7 * The Linode driver now uses the ``linode_v4`` module. * Removed goss verifier diff --git a/Dockerfile b/Dockerfile index d36419556..fcf00b8dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,7 @@ ENV PACKAGES="\ " RUN apk add --update --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ ${PACKAGES} -ENV MOLECULE_EXTRAS="azure,docker,docs,ec2,gce,hetznercloud,linode,lxc,openstack,vagrant,windows" +ENV MOLECULE_EXTRAS="azure,docker,docs,ec2,gce,hetznercloud,linode,openstack,vagrant,windows" # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917006 RUN pip3 install -U wheel diff --git a/docs/configuration.rst b/docs/configuration.rst index edb547666..fff3c89b9 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -114,18 +114,6 @@ Linode .. autoclass:: molecule.driver.linode.Linode() :undoc-members: -LXC -^^^ - -.. autoclass:: molecule.driver.lxc.LXC() - :undoc-members: - -LXD -^^^ - -.. autoclass:: molecule.driver.lxd.LXD() - :undoc-members: - Openstack ^^^^^^^^^ diff --git a/molecule/cookiecutter/molecule/{{cookiecutter.role_name}}/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml b/molecule/cookiecutter/molecule/{{cookiecutter.role_name}}/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml index 9411c1286..2bbf50429 100644 --- a/molecule/cookiecutter/molecule/{{cookiecutter.role_name}}/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml +++ b/molecule/cookiecutter/molecule/{{cookiecutter.role_name}}/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/molecule.yml @@ -32,16 +32,12 @@ platforms: - name: instance server_type: cx11 image: debian-9 -{%- elif cookiecutter.driver_name == 'lxc' %} - - name: instance {%- elif cookiecutter.driver_name == 'linode' %} - name: instance type: g6-nanode-1 state: present region: eu-west image: linode/debian9 -{%- elif cookiecutter.driver_name == 'lxd' %} - - name: instance {%- elif cookiecutter.driver_name == 'openstack' %} - name: instance image: Ubuntu-16.04 diff --git a/molecule/cookiecutter/scenario/driver/lxc/cookiecutter.json b/molecule/cookiecutter/scenario/driver/lxc/cookiecutter.json deleted file mode 100644 index 0e8886501..000000000 --- a/molecule/cookiecutter/scenario/driver/lxc/cookiecutter.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "molecule_directory": "molecule", - "role_name": "OVERRIDEN", - "scenario_name": "OVERRIDEN" -} diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst deleted file mode 100644 index b7da7941b..000000000 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst +++ /dev/null @@ -1,33 +0,0 @@ -******* -LXC driver installation guide -******* - -Requirements -============ - -* LXC - -Install -======= - -Please refer to the `Virtual environment`_ documentation for installation best -practices. If not using a virtual environment, please consider passing the -widely recommended `'--user' flag`_ when invoking ``pip``. - -.. _Virtual environment: https://virtualenv.pypa.io/en/latest/ -.. _'--user' flag: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site - -.. important:: - - Please note, extra system build dependencies may be required for - ``lxc-python2``, which is the Python dependency required for installing this - driver. Python 3.X is currently not supported. - -.. code-block:: bash - - $ pip install 'molecule[lxc]' - -.. important:: - - The Ansible LXC modules do not support unprivileged containers. To properly - use this driver, one must prefix each Molecule command with ``sudo``. diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml deleted file mode 100644 index b23f764c4..000000000 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/create.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -{% raw -%} -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Create molecule instance(s) - lxc_container: - name: "{{ item.name }}" - container_log: true - template: ubuntu - state: started - template_options: --release xenial - container_command: | - until ping -c1 google.com &>/dev/null; do :; done - apt-get update - apt-get install -y python-minimal - with_items: "{{ molecule_yml.platforms }}" -{%- endraw %} diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml deleted file mode 100644 index a8b837163..000000000 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/destroy.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -{% raw %} -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Destroy molecule instance(s) - lxc_container: - name: "{{ item.name }}" - state: absent - with_items: "{{ molecule_yml.platforms }}" -{%- endraw %} diff --git a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml b/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml deleted file mode 100644 index fecf1c843..000000000 --- a/molecule/cookiecutter/scenario/driver/lxc/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Converge - hosts: all - tasks: - - name: "Include {{ cookiecutter.role_name }}" - include_role: - name: "{{ cookiecutter.role_name }}" diff --git a/molecule/cookiecutter/scenario/driver/lxd/cookiecutter.json b/molecule/cookiecutter/scenario/driver/lxd/cookiecutter.json deleted file mode 100644 index 0e8886501..000000000 --- a/molecule/cookiecutter/scenario/driver/lxd/cookiecutter.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "molecule_directory": "molecule", - "role_name": "OVERRIDEN", - "scenario_name": "OVERRIDEN" -} diff --git a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst deleted file mode 100644 index 0e5d54f9d..000000000 --- a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/INSTALL.rst +++ /dev/null @@ -1,14 +0,0 @@ -******* -LXD driver installation guide -******* - -Requirements -============ - -* LXD - -Install -======= - -No additional python packages required. Apt installs necessary requirements -while installing ``lxd``. diff --git a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml b/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml deleted file mode 100644 index fecf1c843..000000000 --- a/molecule/cookiecutter/scenario/driver/lxd/{{cookiecutter.molecule_directory}}/{{cookiecutter.scenario_name}}/playbook.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Converge - hosts: all - tasks: - - name: "Include {{ cookiecutter.role_name }}" - include_role: - name: "{{ cookiecutter.role_name }}" diff --git a/molecule/driver/lxc.py b/molecule/driver/lxc.py deleted file mode 100644 index 28c0d90ee..000000000 --- a/molecule/driver/lxc.py +++ /dev/null @@ -1,91 +0,0 @@ -# Copyright (c) 2015-2018 Cisco Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from molecule import logger -from molecule.api import Driver - -LOG = logger.get_logger(__name__) - - -class LXC(Driver): - """ - The class responsible for managing `LXC`_ containers. `LXC`_ is `not` the - default driver used in Molecule. - - Molecule leverages Ansible's `lxc_container`_ module, by mapping variables - from ``molecule.yml`` into ``create.yml`` and ``destroy.yml``. - - .. _`lxc_container`: https://docs.ansible.com/ansible/latest/lxc_container_module.html - - .. code-block:: yaml - - driver: - name: lxc - - .. code-block:: bash - - $ pip install molecule[lxc] - - Provide a list of files Molecule will preserve, relative to the scenario - ephemeral directory, after any ``destroy`` subcommand execution. - - .. code-block:: yaml - - driver: - name: lxc - safe_files: - - foo - - .. _`LXC`: https://linuxcontainers.org/lxc/introduction/ - """ # noqa - - def __init__(self, config=None): - super(LXC, self).__init__(config) - self._name = 'lxc' - - @property - def name(self): - return self._name - - @name.setter - def name(self, value): - self._name = value - - @property - def login_cmd_template(self): - return 'sudo lxc-attach -n {instance}' - - @property - def default_safe_files(self): - return [] - - @property - def default_ssh_connection_options(self): - return [] - - def login_options(self, instance_name): - return {'instance': instance_name} - - def ansible_connection_options(self, instance_name): - return {'ansible_connection': 'lxc'} - - def sanity_checks(self): - # FIXME(decentral1se): Implement sanity checks - pass diff --git a/molecule/driver/lxd.py b/molecule/driver/lxd.py deleted file mode 100644 index 425672d37..000000000 --- a/molecule/driver/lxd.py +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright (c) 2015-2018 Cisco Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from molecule import logger -from molecule.api import Driver - -LOG = logger.get_logger(__name__) - - -class LXD(Driver): - """ - The class responsible for managing `LXD`_ containers. `LXD`_ is `not` the - default driver used in Molecule. - - Molecule leverages Ansible's `lxd_container`_ module, by mapping variables - from ``molecule.yml`` into ``create.yml`` and ``destroy.yml``. - The `lxd_container`_ module leverages the LXD API. Usefull information - about, for example the source variable can be found in the `LXD API documentation`. - - .. _`lxd_container`: https://docs.ansible.com/ansible/latest/lxd_container_module.html - .. _`LXD API documentation`: https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-1 - - .. code-block:: yaml - - driver: - name: lxd - platforms: - - name: instance - url: https://127.0.0.1:8443 - cert_file: /root/.config/lxc/client.crt - key_file: /root/.config/lxc/client.key - trust_password: password - source: - type: image - mode: pull - server: https://images.linuxcontainers.org - protocol: lxd|simplestreams - alias: ubuntu/xenial/amd64 - architecture: x86_64|i686 - config: - limits.cpu: 2 - devices: - kvm: - path: /dev/kvm - type: unix-char - profiles: - - default - force_stop: True|False - - Provide a list of files Molecule will preserve, relative to the scenario - ephemeral directory, after any ``destroy`` subcommand execution. - - .. code-block:: yaml - - driver: - name: lxd - safe_files: - - foo - - .. _`LXD`: https://linuxcontainers.org/lxd/introduction/ - """ # noqa - - def __init__(self, config=None): - super(LXD, self).__init__(config) - self._name = 'lxd' - - @property - def name(self): - return self._name - - @name.setter - def name(self, value): - self._name = value - - @property - def login_cmd_template(self): - return 'lxc exec {instance} bash' - - @property - def default_safe_files(self): - return [] - - @property - def default_ssh_connection_options(self): - return [] - - def login_options(self, instance_name): - return {'instance': instance_name} - - def ansible_connection_options(self, instance_name): - return {'ansible_connection': 'lxd'} - - def sanity_checks(self): - # FIXME(decentral1se): Implement sanity checks - pass diff --git a/molecule/model/schema_v2.py b/molecule/model/schema_v2.py index 688c20656..d78e40c2f 100644 --- a/molecule/model/schema_v2.py +++ b/molecule/model/schema_v2.py @@ -487,40 +487,6 @@ def pre_validate_base_schema(env, keep_string): } } -platforms_lxd_schema = { - 'platforms': { - 'type': 'list', - 'schema': { - 'type': 'dict', - 'schema': { - 'name': {'type': 'string'}, - 'url': {'type': 'string'}, - 'cert_file': {'type': 'string'}, - 'key_file': {'type': 'string'}, - 'trust_password': {'type': 'string'}, - 'source': { - 'type': 'dict', - 'schema': { - 'type': {'type': 'string'}, - 'mode': {'type': 'string', 'allowed': ['pull', 'local']}, - 'server': {'type': 'string'}, - 'protocol': { - 'type': 'string', - 'allowed': ['lxd', 'simplestreams'], - }, - 'alias': {'type': 'string'}, - }, - }, - 'architecture': {'type': 'string', 'allowed': ['x86_64', 'i686']}, - 'config': {'type': 'dict', 'allow_unknown': True}, - 'devices': {'type': 'dict', 'allow_unknown': True}, - 'profiles': {'type': 'list', 'schema': {'type': 'string'}}, - 'force_stop': {'type': 'boolean'}, - }, - }, - } -} - platforms_hetznercloud_schema = { 'platforms': { 'type': 'list', @@ -643,8 +609,6 @@ def validate(c): elif c['driver']['name'] == 'vagrant': util.merge_dicts(schema, driver_vagrant_provider_section_schema) util.merge_dicts(schema, platforms_vagrant_schema) - elif c['driver']['name'] == 'lxd': - util.merge_dicts(schema, platforms_lxd_schema) elif c['driver']['name'] == 'linode': util.merge_dicts(schema, platforms_linode_schema) elif c['driver']['name'] == 'hetznercloud': diff --git a/molecule/provisioner/ansible/playbooks/lxd/create.yml b/molecule/provisioner/ansible/playbooks/lxd/create.yml deleted file mode 100644 index 88afc9f9b..000000000 --- a/molecule/provisioner/ansible/playbooks/lxd/create.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Create default source variable - set_fact: - default_source: - type: image - server: https://images.linuxcontainers.org - alias: ubuntu/xenial/amd64 - - - name: Create molecule instance(s) - lxd_container: - url: "{{ item.url | default(omit) }}" - cert_file: "{{ item.cert_file | default(omit) }}" - key_file: "{{ item.key_file | default(omit) }}" - trust_password: "{{ item.trust_password | default(omit) }}" - name: "{{ item.name }}" - state: started - source: "{{ default_source | combine(item.source | default({})) }}" - config: "{{ item.config | default(omit) }}" - architecture: "{{ item.architecture | default(omit) }}" - devices: "{{ item.devices | default(omit) }}" - profiles: "{{ item.profiles | default(omit) }}" - wait_for_ipv4_addresses: true - timeout: 600 - with_items: "{{ molecule_yml.platforms }}" - loop_control: - label: "{{ item.name }}" - no_log: false diff --git a/molecule/provisioner/ansible/playbooks/lxd/destroy.yml b/molecule/provisioner/ansible/playbooks/lxd/destroy.yml deleted file mode 100644 index 3e1ad8d6e..000000000 --- a/molecule/provisioner/ansible/playbooks/lxd/destroy.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Destroy molecule instance(s) - lxd_container: - url: "{{ item.url | default(omit)}}" - cert_file: "{{ item.cert_file | default(omit) }}" - key_file: "{{ item.key_file | default(omit) }}" - trust_password: "{{ item.trust_password | default(omit) }}" - name: "{{ item.name }}" - state: absent - force_stop: "{{ item.force_stop | default(true) }}" - with_items: "{{ molecule_yml.platforms }}" - loop_control: - label: "{{ item.name }}" - no_log: false diff --git a/molecule/provisioner/ansible/playbooks/lxd/prepare.yml b/molecule/provisioner/ansible/playbooks/lxd/prepare.yml deleted file mode 100644 index 7c86b2678..000000000 --- a/molecule/provisioner/ansible/playbooks/lxd/prepare.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: Prepare - hosts: all - gather_facts: false - tasks: - - name: Install some basic packages because LXC containers are bare - raw: | - if [ -x "$(command -v apt-get)" ] - then - apt-get update && apt-get install -y ca-certificates curl python sudo - elif [ -x "$(command -v yum)" ] - then - yum install -y ca-certificates curl python sudo - elif [ -x "$(command -v zypper)" ] - then - zypper -n --gpg-auto-import-keys refresh && zypper -n install -y ca-certificates ca-certificates-cacert ca-certificates-mozilla curl python python-xml sudo - elif [ -x "$(command -v apk)" ] - then - apk update && apk add ca-certificates curl python sudo - elif [ -x "$(command -v pacman)" ] - then - pacman -Syu --noconfirm ca-certificates curl python2 sudo - elif [ -x "$(command -v dnf)" ] - then - dnf --assumeyes install ca-certificates curl python python-devel python2-dnf sudo - elif [ -x "$(command -v emerge)" ] - then - emerge --ask n ca-certificates curl dev-lang/python-2 gentoolkit sudo - fi diff --git a/molecule/test/functional/conftest.py b/molecule/test/functional/conftest.py index ab9ac2cd8..dd2cea3f5 100644 --- a/molecule/test/functional/conftest.py +++ b/molecule/test/functional/conftest.py @@ -79,8 +79,6 @@ def skip_test(request, driver_name): 'gce': supports_gce, 'hetznercloud': lambda: at_least_ansible_28() and supports_hetznercloud(), 'linode': lambda: at_least_ansible_28() and supports_linode(), - 'lxc': supports_lxc, - 'lxd': supports_lxd, 'openstack': supports_openstack, 'vagrant': supports_vagrant_virtualbox, 'delegated': demands_delegated, @@ -251,14 +249,6 @@ def get_docker_executable(): return distutils.spawn.find_executable('docker') -def get_lxc_executable(): - return distutils.spawn.find_executable('lxc-start') - - -def get_lxd_executable(): - return distutils.spawn.find_executable('lxd') - - def get_vagrant_executable(): return distutils.spawn.find_executable('vagrant') @@ -294,34 +284,6 @@ def supports_linode(): return _env_vars_exposed(env_vars) and HAS_LINODE_DEPENDENCY -@pytest.helpers.register -def supports_lxc(): - # noqa: E501 # FIXME: Travis CI - # noqa: E501 # This fixes most of the errors: - # noqa: E501 # $ mkdir -p ~/.config/lxc - # noqa: E501 # $ echo "lxc.id_map = u 0 100000 65536" > ~/.config/lxc/default.conf - # noqa: E501 # $ echo "lxc.id_map = g 0 100000 65536" >> ~/.config/lxc/default.conf - # noqa: E501 # $ echo "lxc.network.type = veth" >> ~/.config/lxc/default.conf - # noqa: E501 # $ echo "lxc.network.link = lxcbr0" >> ~/.config/lxc/default.conf - # noqa: E501 # $ echo "$USER veth lxcbr0 2" | sudo tee -a /etc/lxc/lxc-usernet - # noqa: E501 # travis veth lxcbr0 2 - # noqa: E501 # But there's still one left: - # noqa: E501 # $ cat ~/lxc-instance.log - # noqa: E501 # lxc-create 1542112494.884 INFO lxc_utils - utils.c:get_rundir:229 - XDG_RUNTIME_DIR isn't set in the environment. - # noqa: E501 # lxc-create 1542112494.884 WARN lxc_log - log.c:lxc_log_init:331 - lxc_log_init called with log already initialized - # noqa: E501 # lxc-create 1542112494.884 INFO lxc_confile - confile.c:config_idmap:1385 - read uid map: type u nsid 0 hostid 100000 range 65536 - # noqa: E501 # lxc-create 1542112494.884 INFO lxc_confile - confile.c:config_idmap:1385 - read uid map: type g nsid 0 hostid 100000 range 65536 - # noqa: E501 # lxc-create 1542112494.887 ERROR lxc_container - lxccontainer.c:do_create_container_dir:767 - Failed to chown container dir - # noqa: E501 # lxc-create 1542112494.887 ERROR lxc_create_ui - lxc_create.c:main:274 - Error creating container instance - return not IS_TRAVIS and get_lxc_executable() - - -@pytest.helpers.register -def supports_lxd(): - # FIXME: Travis CI - return not IS_TRAVIS and get_lxd_executable() - - @pytest.helpers.register def supports_vagrant_virtualbox(): return get_vagrant_executable() or get_virtualbox_executable() diff --git a/molecule/test/functional/test_command.py b/molecule/test/functional/test_command.py index b36c2498d..dfefbc7af 100644 --- a/molecule/test/functional/test_command.py +++ b/molecule/test/functional/test_command.py @@ -52,8 +52,6 @@ def driver_name(request): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -75,8 +73,6 @@ def test_command_check(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -96,8 +92,6 @@ def test_command_cleanup(scenario_to_test, with_scenario, scenario_name): ('driver/ec2', 'ec2', 'default'), ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -119,8 +113,6 @@ def test_command_converge(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -142,8 +134,6 @@ def test_command_create(scenario_to_test, with_scenario, scenario_name): ('dependency', 'hetznercloud', 'ansible-galaxy'), ('dependency', 'gce', 'ansible-galaxy'), ('dependency', 'linode', 'ansible-galaxy'), - ('dependency', 'lxc', 'ansible-galaxy'), - ('dependency', 'lxd', 'ansible-galaxy'), ('dependency', 'openstack', 'ansible-galaxy'), ('dependency', 'vagrant', 'ansible-galaxy'), ], @@ -175,8 +165,6 @@ def test_command_dependency_ansible_galaxy( ('dependency', 'gce', 'gilt'), ('dependency', 'hetznercloud', 'gilt'), ('dependency', 'linode', 'gilt'), - ('dependency', 'lxc', 'gilt'), - ('dependency', 'lxd', 'gilt'), ('dependency', 'openstack', 'gilt'), ('dependency', 'vagrant', 'gilt'), ], @@ -204,8 +192,6 @@ def test_command_dependency_gilt( ('dependency', 'gce', 'shell'), ('dependency', 'hetznercloud', 'shell'), ('dependency', 'linode', 'shell'), - ('dependency', 'lxc', 'shell'), - ('dependency', 'lxd', 'shell'), ('dependency', 'openstack', 'shell'), ('dependency', 'vagrant', 'shell'), ], @@ -233,8 +219,6 @@ def test_command_dependency_shell( ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -256,8 +240,6 @@ def test_command_destroy(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -276,8 +258,6 @@ def test_command_idempotence(scenario_to_test, with_scenario, scenario_name): ('ec2'), ('gce'), ('linode'), - ('lxc'), - ('lxd'), ('openstack'), ('vagrant'), ], @@ -296,8 +276,6 @@ def test_command_init_role(temp_dir, driver_name, skip_test): ('gce'), ('hetznercloud'), ('linode'), - ('lxc'), - ('lxd'), ('openstack'), ('vagrant'), ], @@ -316,8 +294,6 @@ def test_command_init_scenario(temp_dir, driver_name, skip_test): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -398,28 +374,6 @@ def test_command_lint(scenario_to_test, with_scenario, scenario_name): instance linode ansible default false false instance-1 linode ansible multi-node false false instance-2 linode ansible multi-node false false -""".strip(), - ), # noqa - ( - 'driver/lxc', - 'lxc', - """ -Instance Name Driver Name Provisioner Name Scenario Name Created Converged ---------------- ------------- ------------------ --------------- --------- ----------- -instance lxc ansible default false false -instance-1 lxc ansible multi-node false false -instance-2 lxc ansible multi-node false false -""".strip(), - ), # noqa - ( - 'driver/lxd', - 'lxd', - """ -Instance Name Driver Name Provisioner Name Scenario Name Created Converged ---------------- ------------- ------------------ --------------- --------- ----------- -instance lxd ansible default false false -instance-1 lxd ansible multi-node false false -instance-2 lxd ansible multi-node false false """.strip(), ), # noqa ( @@ -516,24 +470,6 @@ def test_command_list(scenario_to_test, with_scenario, expected): instance linode ansible default false false instance-1 linode ansible multi-node false false instance-2 linode ansible multi-node false false -""".strip(), - ), - ( - 'driver/lxc', - 'lxc', - """ -instance lxc ansible default false false -instance-1 lxc ansible multi-node false false -instance-2 lxc ansible multi-node false false -""".strip(), - ), - ( - 'driver/lxd', - 'lxd', - """ -instance lxd ansible default false false -instance-1 lxd ansible multi-node false false -instance-2 lxd ansible multi-node false false """.strip(), ), ( @@ -615,18 +551,6 @@ def test_command_list_with_format_plain(scenario_to_test, with_scenario, expecte [['instance-1', '.*instance-1.*'], ['instance-2', '.*instance-2.*']], 'multi-node', ), - ( - 'driver/lxc', - 'lxc', - [['instance-1', '.*instance-1.*'], ['instance-2', '.*instance-2.*']], - 'multi-node', - ), - ( - 'driver/lxd', - 'lxd', - [['instance-1', '.*instance-1.*'], ['instance-2', '.*instance-2.*']], - 'multi-node', - ), ( 'driver/openstack', 'openstack', @@ -661,8 +585,6 @@ def test_command_login(scenario_to_test, with_scenario, login_args, scenario_nam ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -688,8 +610,6 @@ def test_command_prepare(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -711,8 +631,6 @@ def test_command_side_effect(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), @@ -736,8 +654,6 @@ def test_command_syntax(scenario_to_test, with_scenario, scenario_name): ('driver/gce', 'gce', None), ('driver/hetznercloud', 'hetznercloud', None), ('driver/linode', 'linode', None), - ('driver/lxc', 'lxc', None), - ('driver/lxd', 'lxd', None), ('driver/openstack', 'openstack', None), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', None), @@ -756,8 +672,6 @@ def test_command_test(scenario_to_test, with_scenario, scenario_name, driver_nam ('driver/gce', 'gce', 'default'), ('driver/hetznercloud', 'hetznercloud', 'default'), ('driver/linode', 'linode', 'default'), - ('driver/lxc', 'lxc', 'default'), - ('driver/lxd', 'lxd', 'default'), ('driver/openstack', 'openstack', 'default'), ('driver/delegated', 'delegated', 'docker'), ('driver/vagrant', 'vagrant', 'default'), diff --git a/molecule/test/resources/playbooks/lxc/create.yml b/molecule/test/resources/playbooks/lxc/create.yml deleted file mode 100644 index 823c0dcae..000000000 --- a/molecule/test/resources/playbooks/lxc/create.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Create molecule instance(s) - lxc_container: - name: "{{ item.name }}" - container_log: true - template: ubuntu - state: started - template_options: --release xenial - container_command: | - until ping -c1 google.com &>/dev/null; do :; done - apt-get update - apt-get install -y python-minimal - with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/test/resources/playbooks/lxc/destroy.yml b/molecule/test/resources/playbooks/lxc/destroy.yml deleted file mode 100644 index 2ea4529f2..000000000 --- a/molecule/test/resources/playbooks/lxc/destroy.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Destroy molecule instance(s) - lxc_container: - name: "{{ item.name }}" - state: absent - with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/test/resources/playbooks/lxd/create.yml b/molecule/test/resources/playbooks/lxd/create.yml deleted file mode 100644 index fd944a1f3..000000000 --- a/molecule/test/resources/playbooks/lxd/create.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: Create - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Create default source variable - set_fact: - default_source: - type: image - server: https://images.linuxcontainers.org - alias: ubuntu/xenial/amd64 - - - name: Create molecule instance(s) - lxd_container: - url: "{{ item.url | default(omit) }}" - cert_file: "{{ item.cert_file | default(omit) }}" - key_file: "{{ item.key_file | default(omit) }}" - trust_password: "{{ item.trust_password | default(omit) }}" - name: "{{ item.name }}" - state: started - source: "{{ default_source | combine(item.source | default({})) }}" - config: "{{ item.config | default(omit) }}" - architecture: "{{ item.architecture | default(omit) }}" - devices: "{{ item.devices | default(omit) }}" - profiles: "{{ item.profiles | default(omit) }}" - wait_for_ipv4_addresses: true - timeout: 600 - with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/test/resources/playbooks/lxd/destroy.yml b/molecule/test/resources/playbooks/lxd/destroy.yml deleted file mode 100644 index 610766ee0..000000000 --- a/molecule/test/resources/playbooks/lxd/destroy.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -- name: Destroy - hosts: localhost - connection: local - gather_facts: false - no_log: "{{ molecule_no_log }}" - tasks: - - name: Destroy molecule instance(s) - lxd_container: - url: "{{ item.url | default(omit)}}" - cert_file: "{{ item.cert_file | default(omit) }}" - key_file: "{{ item.key_file | default(omit) }}" - trust_password: "{{ item.trust_password | default(omit) }}" - name: "{{ item.name }}" - state: absent - force_stop: "{{ item.force_stop | default(true) }}" - with_items: "{{ molecule_yml.platforms }}" diff --git a/molecule/test/scenarios/driver/lxc/molecule/default/molecule.yml b/molecule/test/scenarios/driver/lxc/molecule/default/molecule.yml deleted file mode 100644 index b52acf490..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/default/molecule.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: lxc -lint: - name: yamllint - options: - config-file: ../../../resources/.yamllint -platforms: - - name: instance -provisioner: - name: ansible - config_options: - defaults: - callback_whitelist: profile_roles,profile_tasks,timer - playbooks: - create: ../../../../../resources/playbooks/lxc/create.yml - destroy: ../../../../../resources/playbooks/lxc/destroy.yml - env: - ANSIBLE_ROLES_PATH: ../../../../../resources/roles/ - lint: - name: ansible-lint -scenario: - name: default -verifier: - name: testinfra - lint: - name: flake8 diff --git a/molecule/test/scenarios/driver/lxc/molecule/default/playbook.yml b/molecule/test/scenarios/driver/lxc/molecule/default/playbook.yml deleted file mode 100644 index 01223e7e8..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/default/playbook.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Converge - hosts: all - gather_facts: false - roles: - - molecule diff --git a/molecule/test/scenarios/driver/lxc/molecule/default/tests/test_default.py b/molecule/test/scenarios/driver/lxc/molecule/default/tests/test_default.py deleted file mode 100644 index c5a065648..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/default/tests/test_default.py +++ /dev/null @@ -1,29 +0,0 @@ -import os - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hostname(host): - assert 'instance' == host.check_output('hostname -s') - - -def test_etc_molecule_directory(host): - f = host.file('/etc/molecule') - - assert f.is_directory - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o755 - - -def test_etc_molecule_ansible_hostname_file(host): - f = host.file('/etc/molecule/instance') - - assert f.is_file - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o644 diff --git a/molecule/test/scenarios/driver/lxc/molecule/multi-node/molecule.yml b/molecule/test/scenarios/driver/lxc/molecule/multi-node/molecule.yml deleted file mode 100644 index 90d545a1d..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/multi-node/molecule.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: lxc -lint: - name: yamllint - options: - config-file: ../../../resources/.yamllint -platforms: - - name: instance-1 - groups: - - foo - - bar - - name: instance-2 - groups: - - foo - - baz -provisioner: - name: ansible - config_options: - defaults: - callback_whitelist: profile_roles,profile_tasks,timer - playbooks: - create: ../../../../../resources/playbooks/lxc/create.yml - destroy: ../../../../../resources/playbooks/lxc/destroy.yml - env: - ANSIBLE_ROLES_PATH: ../../../../../resources/roles/ - lint: - name: ansible-lint -scenario: - name: multi-node -verifier: - name: testinfra - lint: - name: flake8 diff --git a/molecule/test/scenarios/driver/lxc/molecule/multi-node/playbook.yml b/molecule/test/scenarios/driver/lxc/molecule/multi-node/playbook.yml deleted file mode 100644 index b85ef1146..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/multi-node/playbook.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Converge - hosts: all - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: bar - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: foo - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: baz - gather_facts: false - roles: - - molecule diff --git a/molecule/test/scenarios/driver/lxc/molecule/multi-node/tests/test_default.py b/molecule/test/scenarios/driver/lxc/molecule/multi-node/tests/test_default.py deleted file mode 100644 index f4239f0b6..000000000 --- a/molecule/test/scenarios/driver/lxc/molecule/multi-node/tests/test_default.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import re - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hostname(host): - assert re.search(r'instance-[12]', host.check_output('hostname -s')) - - -def test_etc_molecule_directory(host): - f = host.file('/etc/molecule') - - assert f.is_directory - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o755 - - -def test_etc_molecule_ansible_hostname_file(host): - filename = '/etc/molecule/{}'.format(host.check_output('hostname -s')) - f = host.file(filename) - - assert f.is_file - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o644 diff --git a/molecule/test/scenarios/driver/lxd/molecule/default/molecule.yml b/molecule/test/scenarios/driver/lxd/molecule/default/molecule.yml deleted file mode 100644 index 76cc33639..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/default/molecule.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: lxd -lint: - name: yamllint - options: - config-file: ../../../resources/.yamllint -platforms: - - name: instance -provisioner: - name: ansible - config_options: - defaults: - callback_whitelist: profile_roles,profile_tasks,timer - playbooks: - create: ../../../../../resources/playbooks/lxd/create.yml - destroy: ../../../../../resources/playbooks/lxd/destroy.yml - env: - ANSIBLE_ROLES_PATH: ../../../../../resources/roles/ - lint: - name: ansible-lint -scenario: - name: default -verifier: - name: testinfra - lint: - name: flake8 diff --git a/molecule/test/scenarios/driver/lxd/molecule/default/playbook.yml b/molecule/test/scenarios/driver/lxd/molecule/default/playbook.yml deleted file mode 100644 index 01223e7e8..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/default/playbook.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Converge - hosts: all - gather_facts: false - roles: - - molecule diff --git a/molecule/test/scenarios/driver/lxd/molecule/default/tests/test_default.py b/molecule/test/scenarios/driver/lxd/molecule/default/tests/test_default.py deleted file mode 100644 index b8e42c66b..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/default/tests/test_default.py +++ /dev/null @@ -1,10 +0,0 @@ -import os -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hostname(host): - assert 'instance' == host.check_output('hostname -s') diff --git a/molecule/test/scenarios/driver/lxd/molecule/multi-node/molecule.yml b/molecule/test/scenarios/driver/lxd/molecule/multi-node/molecule.yml deleted file mode 100644 index 3f69520c4..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/multi-node/molecule.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: lxd -lint: - name: yamllint - options: - config-file: ../../../resources/.yamllint -platforms: - - name: instance-1 - groups: - - foo - - bar - - name: instance-2 - groups: - - foo - - baz -provisioner: - name: ansible - config_options: - defaults: - callback_whitelist: profile_roles,profile_tasks,timer - playbooks: - create: ../../../../../resources/playbooks/lxd/create.yml - destroy: ../../../../../resources/playbooks/lxd/destroy.yml - env: - ANSIBLE_ROLES_PATH: ../../../../../resources/roles/ - lint: - name: ansible-lint -scenario: - name: multi-node -verifier: - name: testinfra - lint: - name: flake8 diff --git a/molecule/test/scenarios/driver/lxd/molecule/multi-node/playbook.yml b/molecule/test/scenarios/driver/lxd/molecule/multi-node/playbook.yml deleted file mode 100644 index b85ef1146..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/multi-node/playbook.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Converge - hosts: all - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: bar - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: foo - gather_facts: false - roles: - - molecule - -- name: Converge - hosts: baz - gather_facts: false - roles: - - molecule diff --git a/molecule/test/scenarios/driver/lxd/molecule/multi-node/tests/test_default.py b/molecule/test/scenarios/driver/lxd/molecule/multi-node/tests/test_default.py deleted file mode 100644 index f4239f0b6..000000000 --- a/molecule/test/scenarios/driver/lxd/molecule/multi-node/tests/test_default.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import re - -import testinfra.utils.ansible_runner - -testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') - - -def test_hostname(host): - assert re.search(r'instance-[12]', host.check_output('hostname -s')) - - -def test_etc_molecule_directory(host): - f = host.file('/etc/molecule') - - assert f.is_directory - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o755 - - -def test_etc_molecule_ansible_hostname_file(host): - filename = '/etc/molecule/{}'.format(host.check_output('hostname -s')) - f = host.file(filename) - - assert f.is_file - assert f.user == 'root' - assert f.group == 'root' - assert f.mode == 0o644 diff --git a/molecule/test/unit/cookiecutter/test_molecule.py b/molecule/test/unit/cookiecutter/test_molecule.py index ece40f727..c6bd30cf9 100644 --- a/molecule/test/unit/cookiecutter/test_molecule.py +++ b/molecule/test/unit/cookiecutter/test_molecule.py @@ -101,8 +101,6 @@ def test_vagrant_driver( ('gce'), ('hetznercloud'), ('linode'), - ('lxc'), - ('lxd'), ('openstack'), ('vagrant'), ], diff --git a/molecule/test/unit/driver/test_lxc.py b/molecule/test/unit/driver/test_lxc.py deleted file mode 100644 index 99f1e7084..000000000 --- a/molecule/test/unit/driver/test_lxc.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2015-2018 Cisco Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -import os - -import pytest - -from molecule import config -from molecule.driver import lxc - - -@pytest.fixture -def _instance(config_instance): - return lxc.LXC(config_instance) - - -def test_config_private_member(_instance): - assert isinstance(_instance._config, config.Config) - - -def test_testinfra_options_property(_instance): - assert { - 'connection': 'ansible', - 'ansible-inventory': _instance._config.provisioner.inventory_file, - } == _instance.testinfra_options - - -def test_name_property(_instance): - assert 'lxc' == _instance.name - - -def test_options_property(_instance): - x = {'managed': True} - - assert x == _instance.options - - -def test_login_cmd_template_property(_instance): - assert 'sudo lxc-attach -n {instance}' == _instance.login_cmd_template - - -def test_safe_files_property(_instance): - assert [] == _instance.safe_files - - -def test_default_safe_files_property(_instance): - assert [] == _instance.default_safe_files - - -def test_delegated_property(_instance): - assert not _instance.delegated - - -def test_managed_property(_instance): - assert _instance.managed - - -def test_default_ssh_connection_options_property(_instance): - assert [] == _instance.default_ssh_connection_options - - -def test_login_options(_instance): - assert {'instance': 'foo'} == _instance.login_options('foo') - - -def test_ansible_connection_options(_instance): - x = {'ansible_connection': 'lxc'} - - assert x == _instance.ansible_connection_options('foo') - - -def test_instance_config_property(_instance): - x = os.path.join( - _instance._config.scenario.ephemeral_directory, 'instance_config.yml' - ) - - assert x == _instance.instance_config - - -def test_ssh_connection_options_property(_instance): - assert [] == _instance.ssh_connection_options - - -def test_status(mocker, _instance): - result = _instance.status() - - assert 2 == len(result) - - assert result[0].instance_name == 'instance-1' - assert result[0].driver_name == 'lxc' - assert result[0].provisioner_name == 'ansible' - assert result[0].scenario_name == 'default' - assert result[0].created == 'false' - assert result[0].converged == 'false' - - assert result[1].instance_name == 'instance-2' - assert result[1].driver_name == 'lxc' - assert result[1].provisioner_name == 'ansible' - assert result[1].scenario_name == 'default' - assert result[1].created == 'false' - assert result[1].converged == 'false' - - -def test_created_property(_instance): - assert 'false' == _instance._created() - - -def test_converged_property(_instance): - assert 'false' == _instance._converged() diff --git a/molecule/test/unit/driver/test_lxd.py b/molecule/test/unit/driver/test_lxd.py deleted file mode 100644 index 36d60755c..000000000 --- a/molecule/test/unit/driver/test_lxd.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (c) 2015-2018 Cisco Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -import os - -import pytest - -from molecule import config -from molecule.driver import lxd - - -@pytest.fixture -def _instance(config_instance): - return lxd.LXD(config_instance) - - -def test_config_private_member(_instance): - assert isinstance(_instance._config, config.Config) - - -def test_testinfra_options_property(_instance): - assert { - 'connection': 'ansible', - 'ansible-inventory': _instance._config.provisioner.inventory_file, - } == _instance.testinfra_options - - -def test_name_property(_instance): - assert 'lxd' == _instance.name - - -def test_options_property(_instance): - x = {'managed': True} - - assert x == _instance.options - - -def test_login_cmd_template_property(_instance): - assert 'lxc exec {instance} bash' == _instance.login_cmd_template - - -def test_safe_files_property(_instance): - assert [] == _instance.safe_files - - -def test_default_safe_files_property(_instance): - assert [] == _instance.default_safe_files - - -def test_delegated_property(_instance): - assert not _instance.delegated - - -def test_managed_property(_instance): - assert _instance.managed - - -def test_default_ssh_connection_options_property(_instance): - assert [] == _instance.default_ssh_connection_options - - -def test_login_options(_instance): - assert {'instance': 'foo'} == _instance.login_options('foo') - - -def test_ansible_connection_options(_instance): - x = {'ansible_connection': 'lxd'} - - assert x == _instance.ansible_connection_options('foo') - - -def test_instance_config_property(_instance): - x = os.path.join( - _instance._config.scenario.ephemeral_directory, 'instance_config.yml' - ) - - assert x == _instance.instance_config - - -def test_ssh_connection_options_property(_instance): - assert [] == _instance.ssh_connection_options - - -def test_status(mocker, _instance): - result = _instance.status() - - assert 2 == len(result) - - assert result[0].instance_name == 'instance-1' - assert result[0].driver_name == 'lxd' - assert result[0].provisioner_name == 'ansible' - assert result[0].scenario_name == 'default' - assert result[0].created == 'false' - assert result[0].converged == 'false' - - assert result[1].instance_name == 'instance-2' - assert result[1].driver_name == 'lxd' - assert result[1].provisioner_name == 'ansible' - assert result[1].scenario_name == 'default' - assert result[1].created == 'false' - assert result[1].converged == 'false' - - -def test_created(_instance): - assert 'false' == _instance._created() - - -def test_converged(_instance): - assert 'false' == _instance._converged() diff --git a/molecule/test/unit/model/v2/test_driver_section.py b/molecule/test/unit/model/v2/test_driver_section.py index 4fb2c20f8..6fea04c73 100644 --- a/molecule/test/unit/model/v2/test_driver_section.py +++ b/molecule/test/unit/model/v2/test_driver_section.py @@ -186,16 +186,6 @@ def _model_driver_allows_gce_section_data(): return {'driver': {'name': 'gce'}} -@pytest.fixture -def _model_driver_allows_lxc_section_data(): - return {'driver': {'name': 'lxc'}} - - -@pytest.fixture -def _model_driver_allows_lxd_section_data(): - return {'driver': {'name': 'lxd'}} - - @pytest.fixture def _model_driver_allows_openstack_section_data(): return {'driver': {'name': 'openstack'}} @@ -215,8 +205,6 @@ def _model_driver_allows_vagrant_section_data(): ('_model_driver_allows_docker_section_data'), ('_model_driver_allows_ec2_section_data'), ('_model_driver_allows_gce_section_data'), - ('_model_driver_allows_lxc_section_data'), - ('_model_driver_allows_lxd_section_data'), ('_model_driver_allows_openstack_section_data'), ('_model_driver_allows_vagrant_section_data'), ], diff --git a/molecule/test/unit/model/v2/test_platforms_section.py b/molecule/test/unit/model/v2/test_platforms_section.py index 67e3de942..03b5a7177 100644 --- a/molecule/test/unit/model/v2/test_platforms_section.py +++ b/molecule/test/unit/model/v2/test_platforms_section.py @@ -320,106 +320,6 @@ def test_platforms_vagrant_has_errors(_config): assert x == schema_v2.validate(_config) -@pytest.fixture -def _model_platforms_lxd_section_data(): - return { - 'driver': {'name': 'lxd'}, - 'platforms': [ - { - 'name': 'instance', - 'url': 'https://127.0.0.1:8443', - 'cert_file': '/root/.config/lxc/client.crt', - 'key_file': '/root/.config/lxc/client.key', - 'trust_password': 'password', - 'source': { - 'type': 'image', - 'mode': 'pull', - 'protocol': 'lxd', - 'server': 'https://images.linuxcontainers.org', - 'alias': 'ubuntu/xenial/amd64', - }, - 'architecture': 'x86_64', - 'config': {'limits.cpu': '2'}, - 'devices': {'kvm': {'path': '/dev/kvm', 'type': 'unix-char'}}, - 'profiles': ['default'], - 'force_stop': True, - } - ], - } - - -@pytest.mark.parametrize( - '_config', ['_model_platforms_lxd_section_data'], indirect=True -) -def test_platforms_lxd(_config): - assert {} == schema_v2.validate(_config) - - -@pytest.fixture -def _model_platforms_lxd_errors_section_data(): - return { - 'driver': {'name': 'lxd'}, - 'platforms': [ - { - 'name': int(), - 'url': int(), - 'cert_file': int(), - 'key_file': int(), - 'trust_password': int(), - 'source': { - 'type': int(), - 'mode': 'set for mode', - 'server': int(), - 'protocol': 'set for protocol', - 'alias': int(), - }, - 'architecture': 'set for architecture', - 'config': int(), - 'devices': int(), - 'profiles': [int()], - 'force_stop': int(), - } - ], - } - - -@pytest.mark.parametrize( - '_config', ['_model_platforms_lxd_errors_section_data'], indirect=True -) -def test_platforms_lxd_has_errors(_config): - x = { - 'platforms': [ - { - 0: [ - { - 'name': ['must be of string type'], - 'url': ['must be of string type'], - 'cert_file': ['must be of string type'], - 'key_file': ['must be of string type'], - 'trust_password': ['must be of string type'], - 'source': [ - { - 'alias': ['must be of string type'], - 'mode': ['unallowed value set for mode'], - 'protocol': ['unallowed value set for protocol'], - 'server': ['must be of string type'], - 'type': ['must be of string type'], - } - ], - 'architecture': ['unallowed value set for architecture'], - 'config': ['must be of dict type'], - 'devices': ['must be of dict type'], - 'profiles': [{0: ['must be of string type']}], - 'force_stop': ['must be of boolean type'], - } - ] - } - ] - } - - assert x == schema_v2.validate(_config) - - def test_platforms_driver_name_required(_config): del _config['platforms'][0]['name'] x = {'platforms': [{0: [{'name': ['required field']}]}]} diff --git a/molecule/test/unit/test_config.py b/molecule/test/unit/test_config.py index 45fc72b06..b23b84142 100644 --- a/molecule/test/unit/test_config.py +++ b/molecule/test/unit/test_config.py @@ -137,16 +137,6 @@ def _config_driver_gce_section_data(): return {'driver': {'name': 'gce'}} -@pytest.fixture -def _config_driver_lxc_section_data(): - return {'driver': {'name': 'lxc'}} - - -@pytest.fixture -def _config_driver_lxd_section_data(): - return {'driver': {'name': 'lxd'}} - - @pytest.fixture def _config_driver_openstack_section_data(): return {'driver': {'name': 'openstack'}} diff --git a/setup.cfg b/setup.cfg index 0613eeb38..6e383ba96 100644 --- a/setup.cfg +++ b/setup.cfg @@ -117,8 +117,6 @@ hetznercloud = hcloud>=1.2.1 linode = linode_api4 >= 2.0.0, < 3.0 -lxc = - lxc-python2; python_version<"3.0" and sys_platform=="linux2" openstack = shade vagrant = @@ -148,8 +146,6 @@ molecule.driver = gce = molecule.driver.gce:GCE hetznercloud = molecule.driver.hetznercloud:HetznerCloud linode = molecule.driver.linode:Linode - lxc = molecule.driver.lxc:LXC - lxd = molecule.driver.lxd:LXD openstack = molecule.driver.openstack:Openstack podman = molecule.driver.podman:Podman vagrant = molecule.driver.vagrant:Vagrant diff --git a/tox.ini b/tox.ini index 64560bf4a..f90ba5874 100644 --- a/tox.ini +++ b/tox.ini @@ -34,7 +34,6 @@ extras = gce hetznercloud linode - lxc openstack vagrant windows