Skip to content

Commit

Permalink
Remove molecule ansible filters
Browse files Browse the repository at this point in the history
Molecule filters are now moved to their own project:
https://galaxy.ansible.com/community/molecule

Fixes: #2872
  • Loading branch information
ssbarnea committed Oct 10, 2020
1 parent 20e1fa8 commit 9ff1e3b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 103 deletions.
2 changes: 2 additions & 0 deletions molecule/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@

RC_SUCCESS = 0
RC_TIMEOUT = 3

MOLECULE_HEADER = "# Molecule managed"
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
{%- endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

- name: Dump instance config
copy:
content: "{{ instance_conf | to_json | from_json | molecule_to_yaml | molecule_header }}"
content: |
# Molecule managed
{{ instance_conf | to_json | from_json | to_yaml }}
dest: "{{ molecule_instance_config }}"
when: server.changed | default(false) | bool
{%- endraw %}
2 changes: 1 addition & 1 deletion molecule/provisioner/ansible.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def inventory(self):
"molecule_file": "{{ lookup('env', 'MOLECULE_FILE') }}",
"molecule_ephemeral_directory": "{{ lookup('env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}",
"molecule_scenario_directory": "{{ lookup('env', 'MOLECULE_SCENARIO_DIRECTORY') }}",
"molecule_yml": "{{ lookup('file', molecule_file) | molecule_from_yaml }}",
"molecule_yml": "{{ lookup('file', molecule_file) | from_yaml }}",
"molecule_instance_config": "{{ lookup('env', 'MOLECULE_INSTANCE_CONFIG') }}",
"molecule_no_log": "{{ lookup('env', 'MOLECULE_NO_LOG') or not "
"molecule_yml.provisioner.log|default(False) | bool }}",
Expand Down
98 changes: 0 additions & 98 deletions molecule/provisioner/ansible/plugins/filter/molecule_core.py

This file was deleted.

3 changes: 2 additions & 1 deletion molecule/test/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import sh

from molecule import util
from molecule.constants import MOLECULE_HEADER

colorama.init(autoreset=True)

Expand Down Expand Up @@ -233,7 +234,7 @@ def test_write_file(temp_dir):


def molecule_prepender(content):
x = "# Molecule managed\n\nfoo bar"
x = f"{MOLECULE_HEADER}\nfoo bar"

assert x == util.file_prepender("foo bar")

Expand Down
3 changes: 2 additions & 1 deletion molecule/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import jinja2
import yaml

from molecule.constants import MOLECULE_HEADER
from molecule.logger import get_logger

LOG = get_logger(__name__)
Expand Down Expand Up @@ -164,7 +165,7 @@ def write_file(filename, content):

def molecule_prepender(content):
"""Return molecule identification header."""
return "# Molecule managed\n\n" + content
return MOLECULE_HEADER + "\n\n" + content


def file_prepender(filename):
Expand Down

0 comments on commit 9ff1e3b

Please sign in to comment.