Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit 3dddf57

Browse files
committed
Remove delgated special treatment
Based on user feedback from #45 we remove custom handling recently introduced for delegated scenarios.
1 parent 92cb82b commit 3dddf57

File tree

2 files changed

+0
-45
lines changed

2 files changed

+0
-45
lines changed

README.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ when molecule drivers are not loading. Current default is ``skip`` but you
5454
can choose other marks like ``xfail`` or empty string if you want to disable
5555
this functionality.
5656

57-
Current implementation of this feature validates only ``docker`` and
58-
``delegated`` drivers. Due to the potential destructive nature of delegated
59-
driver, scenarios running it will run only if Ansible detects one of the
60-
following variables as defined: ``zuul``, ``use_for_testing``.
61-
6257
Installation
6358
------------
6459

pytest_molecule/__init__.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -76,46 +76,6 @@ def pytest_configure(config):
7676
logging.getLogger().warning(msg)
7777
config.option.molecule[driver]["available"] = False
7878

79-
if driver == "delegated":
80-
# To protect ourselves from case where a molecule scenario using
81-
# `delegated` is accidentally altering the localhost on a developer
82-
# machine, we verify run delegated tests only when ansible `zuul`
83-
# or `use_for_testing` vars are defined.
84-
cmd = [
85-
"ansible",
86-
"localhost",
87-
"-e",
88-
"ansible_connection=local",
89-
"-o",
90-
"-m",
91-
"shell",
92-
"-a",
93-
"exit {% if zuul is defined or use_for_testing is defined %}0{% else %}1{% endif %}",
94-
]
95-
try:
96-
p = subprocess.Popen(
97-
cmd,
98-
stdout=subprocess.DEVNULL,
99-
stderr=subprocess.DEVNULL,
100-
universal_newlines=True,
101-
)
102-
p.wait()
103-
if p.returncode != 0:
104-
raise Exception(
105-
"Error code %s returned by: %s"
106-
% (p.returncode, " ".join(cmd))
107-
)
108-
except Exception:
109-
msg = "Molecule {} driver was not enabled because missing zuul.build variable in current inventory.".format(
110-
driver
111-
)
112-
if config.option.molecule_unavailable_driver:
113-
msg += " We will tag scenarios using it with '{}' marker.".format(
114-
config.option.molecule_unavailable_driver
115-
)
116-
logging.getLogger().warning(msg)
117-
config.option.molecule[driver]["available"] = False
118-
11979
config.addinivalue_line(
12080
"markers", "molecule: mark used by all molecule scenarios"
12181
)

0 commit comments

Comments
 (0)