Rename driver file to match API expectations
This commit is contained in:
parent
0701d0aafd
commit
9ab4f23782
@ -28,63 +28,6 @@ log = logger.get_logger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class HetznerCloud(Driver):
|
class HetznerCloud(Driver):
|
||||||
"""
|
|
||||||
The class responsible for managing `Hetzner Cloud`_ instances.
|
|
||||||
`Hetzner Cloud`_ is **not** the default driver used in Molecule.
|
|
||||||
|
|
||||||
Molecule leverages Ansible's `hcloud_server module`_, by mapping variables
|
|
||||||
from ``molecule.yml`` into ``create.yml`` and ``destroy.yml``.
|
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
The ``hcloud_server`` module is only available in Ansible >= 2.8.
|
|
||||||
|
|
||||||
.. _`hcloud_server module`: https://docs.ansible.com/ansible/devel/modules/hcloud_server_module.html#hcloud-server-module
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
driver:
|
|
||||||
name: hetznercloud
|
|
||||||
platforms:
|
|
||||||
- name: instance
|
|
||||||
server_type: cx11
|
|
||||||
image: debian-9
|
|
||||||
|
|
||||||
.. code-block:: bash
|
|
||||||
|
|
||||||
$ pip install 'molecule[hetznercloud]'
|
|
||||||
|
|
||||||
Change the options passed to the ssh client.
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
driver:
|
|
||||||
name: hetznercloud
|
|
||||||
ssh_connection_options:
|
|
||||||
- '-o ControlPath=~/.ansible/cp/%r@%h-%p'
|
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
The Hetzner Cloud driver implementation uses the Parmiko transport
|
|
||||||
provided by Ansible to avoid issues of connection hanging and
|
|
||||||
indefinite polling as experienced with the default OpenSSh based
|
|
||||||
transport.
|
|
||||||
|
|
||||||
.. important::
|
|
||||||
|
|
||||||
Molecule does not merge lists, when overriding the developer must
|
|
||||||
provide all options.
|
|
||||||
|
|
||||||
Provide the files Molecule will preserve upon each subcommand execution.
|
|
||||||
|
|
||||||
.. code-block:: yaml
|
|
||||||
|
|
||||||
driver:
|
|
||||||
name: hetznercloud
|
|
||||||
safe_files:
|
|
||||||
- foo
|
|
||||||
""" # noqa
|
|
||||||
|
|
||||||
def __init__(self, config=None):
|
def __init__(self, config=None):
|
||||||
super(HetznerCloud, self).__init__(config)
|
super(HetznerCloud, self).__init__(config)
|
||||||
self._name = "hetznercloud"
|
self._name = "hetznercloud"
|
||||||
@ -137,8 +80,6 @@ class HetznerCloud(Driver):
|
|||||||
except StopIteration:
|
except StopIteration:
|
||||||
return {}
|
return {}
|
||||||
except IOError:
|
except IOError:
|
||||||
# Instance has yet to be provisioned , therefore the
|
|
||||||
# instance_config is not on disk.
|
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
def template_dir(self):
|
def template_dir(self):
|
||||||
@ -165,8 +106,8 @@ class HetznerCloud(Driver):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
msg = (
|
msg = (
|
||||||
"Missing Hetzner Cloud driver dependency. Please "
|
"Missing Hetzner Cloud driver dependency. Please "
|
||||||
"install via 'molecule[hetznercloud]' or refer to "
|
"install the 'molecule-hetznercloud' package or "
|
||||||
"your INSTALL.rst driver documentation file"
|
"refer to your INSTALL.rst driver documentation file"
|
||||||
)
|
)
|
||||||
sysexit_with_message(msg)
|
sysexit_with_message(msg)
|
||||||
|
|
@ -21,13 +21,14 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from molecule import config
|
from molecule import config
|
||||||
from molecule_hetznercloud import hetznercloud
|
from molecule_hetznercloud import driver
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def hetznercloud_instance(patched_config_validate, config_instance):
|
def hetznercloud_instance(patched_config_validate, config_instance):
|
||||||
return hetznercloud.HetznerCloud(config_instance)
|
return driver.HetznerCloud(config_instance)
|
||||||
|
|
||||||
|
|
||||||
def test_hetznercloud_config_gives_config_object(hetznercloud_instance):
|
def test_hetznercloud_config_gives_config_object(hetznercloud_instance):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user