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

test: check generated files for ansible_managed, fingerprint #30

Merged
merged 1 commit into from
Apr 19, 2023

Conversation

richm
Copy link
Contributor

@richm richm commented Apr 18, 2023

Add the following files: tests/tasks/check_header.yml and
tests/templates/get_ansible_managed.j2.
Use check_header.yml to check generated files for the ansible_managed
and fingerprint headers.
check_header.yml takes two parameters:

  • __file - required - the full path of the file to check e.g. /etc/realmd.conf
  • __fingerprint - required - the fingerprint string system_role:$ROLENAME e.g.
    __fingerprint: "system_role:postfix"
  • __comment_type - optional, default plain - the type of comments used

e.g. __comment_type: c for C/C++-style comments. plain uses #.
See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html#adding-comments-to-files
for the different types of comment styles supported.

Example:

- name: Check realmd header for ansible_managed, fingerprint
  include_tasks: tasks/check_header.yml
  vars:
    __file: /etc/realmd.conf
    __fingerprint: "system_role:ad_integration"

@richm richm requested a review from spetrosi as a code owner April 18, 2023 23:43
@richm
Copy link
Contributor Author

richm commented Apr 18, 2023

[citest]

@richm
Copy link
Contributor Author

richm commented Apr 19, 2023

[citest]

@richm richm changed the title check generated files for ansible_managed, fingerprint test: check generated files for ansible_managed, fingerprint Apr 19, 2023
Add the following files: tests/tasks/check_header.yml and
tests/templates/get_ansible_managed.j2.
Use check_header.yml to check generated files for the ansible_managed
and fingerprint headers.
check_header.yml takes two parameters:

* `__file` - required - the full path of the file to check e.g. `/etc/realmd.conf`
* `__fingerprint` - required - the fingerprint string `system_role:$ROLENAME` e.g.
  `__fingerprint: "system_role:postfix"`
* `__comment_type` - optional, default `plain` - the type of comments used

e.g. `__comment_type: c` for C/C++-style comments.  `plain` uses `#`.
See https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html#adding-comments-to-files
for the different types of comment styles supported.

Example:
```
- name: Check realmd header for ansible_managed, fingerprint
  include_tasks: tasks/check_header.yml
  vars:
    __file: /etc/realmd.conf
    __fingerprint: "system_role:ad_integration"
```
@richm richm merged commit 0f209bf into linux-system-roles:main Apr 19, 2023
@richm richm deleted the check_fingerprint branch April 19, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants