Update the _skeleton_ role for proper file generation
This change updates the _skeleton_ role so that the files it generates are properly formatted. When a new role is generated the resulting code will now pass all linting checks by default. Before this change several files, which were assumed to be needing modification by the developer, would fail lint checks right after generation due to newline issues at the end of the file. A test has been added to ensure the role generation process produces minimally functional role that is 100% compliant. Change-Id: I28526b022b8c2b5281d2a536231ebcac3b0a7662 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
eb3dd70fc9
commit
7ce3a92ff5
@ -19,3 +19,4 @@
|
|||||||
|
|
||||||
# All variables within this role should have a prefix of "{{ role_name }}"
|
# All variables within this role should have a prefix of "{{ role_name }}"
|
||||||
{{ role_name }}_debug: false
|
{{ role_name }}_debug: false
|
||||||
|
|
||||||
|
@ -42,3 +42,4 @@ galaxy_info:
|
|||||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
# if you add dependencies to this list.
|
# if you add dependencies to this list.
|
||||||
dependencies: []
|
dependencies: []
|
||||||
|
|
||||||
|
@ -35,3 +35,4 @@ RUN easy_install {{ pkg }}
|
|||||||
{% endraw %}
|
{% endraw %}
|
||||||
|
|
||||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
||||||
|
|
||||||
|
@ -19,3 +19,4 @@
|
|||||||
hosts: all
|
hosts: all
|
||||||
roles:
|
roles:
|
||||||
- role: "{{ role_name }}"
|
- role: "{{ role_name }}"
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# "{{ role_name }}" will search for and load any operating system variable file
|
# "{{ role_name }}" will search for and load any operating system variable file
|
||||||
|
{% raw %}
|
||||||
# found within the "vars/" path. If no OS files are found the task will skip.
|
# found within the "vars/" path. If no OS files are found the task will skip.
|
||||||
- name: Gather variables for each operating system
|
- name: Gather variables for each operating system
|
||||||
include_vars: "{{ item }}"
|
include_vars: "{{ item }}"
|
||||||
@ -30,3 +31,4 @@
|
|||||||
- "{{ ansible_os_family | lower }}.yml"
|
- "{{ ansible_os_family | lower }}.yml"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
{% endraw %}
|
10
tox.ini
10
tox.ini
@ -104,6 +104,16 @@ ignore = D001
|
|||||||
[testenv:venv]
|
[testenv:venv]
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
|
[testenv:role-addition]
|
||||||
|
basepython={[testenv:mol]basepython}
|
||||||
|
deps=
|
||||||
|
{[testenv:mol]deps}
|
||||||
|
{[testenv:linters]deps}
|
||||||
|
commands =
|
||||||
|
bash -c "ansible-playbook -i localhost, role-addition.yml -e role_name=skeleton_test"
|
||||||
|
bash -c "pushd {toxinidir}/tripleo_ansible/roles/skeleton_test; molecule test --all; popd"
|
||||||
|
{[testenv:linters]commands}
|
||||||
|
|
||||||
[testenv:mol] # environment naming scheme "mol-$ROLE_NAME"
|
[testenv:mol] # environment naming scheme "mol-$ROLE_NAME"
|
||||||
# basepython forces tox to use system python and avoid other
|
# basepython forces tox to use system python and avoid other
|
||||||
# python versions like pyenv ones
|
# python versions like pyenv ones
|
||||||
|
@ -6,12 +6,14 @@
|
|||||||
- tripleo-ansible-centos-7-molecule-test_deps
|
- tripleo-ansible-centos-7-molecule-test_deps
|
||||||
- tripleo-ansible-centos-7-molecule-test_package_action
|
- tripleo-ansible-centos-7-molecule-test_package_action
|
||||||
- tripleo-ansible-centos-7-molecule-tuned
|
- tripleo-ansible-centos-7-molecule-tuned
|
||||||
|
- tripleo-ansible-centos-7-role-addition
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- tripleo-ansible-centos-7-molecule-aide
|
- tripleo-ansible-centos-7-molecule-aide
|
||||||
- tripleo-ansible-centos-7-molecule-test_deps
|
- tripleo-ansible-centos-7-molecule-test_deps
|
||||||
- tripleo-ansible-centos-7-molecule-test_package_action
|
- tripleo-ansible-centos-7-molecule-test_package_action
|
||||||
- tripleo-ansible-centos-7-molecule-tuned
|
- tripleo-ansible-centos-7-molecule-tuned
|
||||||
|
- tripleo-ansible-centos-7-role-addition
|
||||||
name: tripleo-ansible-molecule-jobs
|
name: tripleo-ansible-molecule-jobs
|
||||||
- job:
|
- job:
|
||||||
files:
|
files:
|
||||||
@ -42,3 +44,11 @@
|
|||||||
parent: tripleo-ansible-centos
|
parent: tripleo-ansible-centos
|
||||||
vars:
|
vars:
|
||||||
tox_envlist: mol-tuned
|
tox_envlist: mol-tuned
|
||||||
|
- job:
|
||||||
|
files:
|
||||||
|
- ^_skeleton_role_/.*
|
||||||
|
- ^role-addition.yml
|
||||||
|
name: tripleo-ansible-centos-7-role-addition
|
||||||
|
parent: tripleo-ansible-centos
|
||||||
|
vars:
|
||||||
|
tox_envlist: role-addition
|
||||||
|
Loading…
Reference in New Issue
Block a user