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

Removed molecule ansible filters #2869

Merged
merged 1 commit into from
Oct 10, 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
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