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

Generate newer version of test-info.yml #96

Merged
merged 4 commits into from
May 8, 2024
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
1 change: 1 addition & 0 deletions playbooks/ansible/client-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
become_method: sudo
vars_files:
- config.yml
- cluster-{{ config.be.name }}.yml
roles:
- tests
12 changes: 0 additions & 12 deletions playbooks/ansible/roles/client.prep/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@
root@{{ config.groups['cluster'][0] }}:{{ config.paths.mount }}/{{ item.name }}
{{ config.paths.mount }}/backends/{{ item.name }}
with_items: "{{ samba_shares }}"

- name: Create the test-info.yml file with test cluster information
template:
src: test-info.yml.j2
dest: /root/test-info.yml
vars:
private_interfaces: "{{ ctdb_network_private_interfaces }}"
public_interfaces: "{{ ctdb_network_public_interfaces }}"
exported_sharenames: >-
{{ samba_shares | map(attribute='name') |
map('regex_replace', '$', '-' + config.be.name + '-' + config.be.variant) | list }}
test_backend: "{{ config.be.name }}"
23 changes: 0 additions & 23 deletions playbooks/ansible/roles/client.prep/templates/test-info.yml.j2

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
version: "{{ test_repo_branch }}"
dest: /root/sit-test-cases

- name: Create the test-info.yml file with test cluster information
template:
src: test-info.yml.j2
dest: /root/test-info.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put it directly in /root/sit-test-cases/test-info.yml and avoid the symlink creation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to remember why I did it like this. I think I did it for re-use. ie. in case other testing projects wanted to make use of the information in that config file.
Another advantage is in a devel environment where we want to delete the whole sit-test-cases repo and redo the folder, it is easier if the configuration is outside the directory.

If it isn't too much of an issue, can we leave it as it is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it was a simple case of the repo being pulled after the test-info.yml file was created and hence the conf file wasn't created inside the repo . :) but the points above still hold.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to remember why I did it like this. I think I did it for re-use. ie. in case other testing projects wanted to make use of the information in that config file.

The contents of the file are very sit-test-cases specific (that's why I suggested moving it inside the test.sit-test-cases role), so it's unlikely that it will be reused by other tests. Each test can create it's own custom configuration if required.

Another advantage is in a devel environment where we want to delete the whole sit-test-cases repo and redo the folder, it is easier if the configuration is outside the directory.

You still need to re-run the playbook to recreate the symlink. It's true that you can do it manually, though.

If it isn't too much of an issue, can we leave it as it is?

Yes, it's not a big problem, and it's contained all inside the test.sit-test-cases role, so if you prefer to keep it this way, I'm ok with that.

vars:
public_interfaces: "{{ ctdb_network_public_interfaces }}"
sharenames: "{{ samba_shares | map(attribute='name') | list }}"
test_backend: "{{ config.be.name }}"

- name: Create a symlink for test-info.yml file
file:
src: /root/test-info.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server: {{ public_interfaces[0] }}

users:
{%- for name in config.accounts +%}
{%- for user_name in config.accounts[name].users +%}
{%- set user = config.accounts[name].users[user_name] +%}
{%- if user.samba +%}
{{ user_name }}: {{ user.password }}
{%- endif +%}
{%- endfor +%}
{%- endfor +%}

backend: {{ test_backend }}

shares:
{%- for share in sharenames +%}
{{ share }}-{{ config.be.name }}-{{ config.be.variant }}:
backend:
path: {{ config.paths.mount }}/backends/{{ share }}
{%- endfor +%}
Loading