Skip to content

Commit

Permalink
fix: Fix server selection in update-user while preserving nice displa…
Browse files Browse the repository at this point in the history
…y of server along with its alt_name in the list

This commit fixes a bug preventing correct selection of server when trying to update users. It improves the prompt's clarity by providing both server name and IP_subject_alt_name. It also ensures server selection from the list uses actual server names instead of list descriptions strings that caused the initial bug.
  • Loading branch information
RochMoreau committed Jun 11, 2024
1 parent 5a275cd commit a66dbbf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@
set_fact:
server_list: >-
[{% for i in _configs_list.files %}
{% set config = lookup('file', i.path)|from_yaml %}
'{{ config.server }}'
'{{ config.IP_subject_alt_name }}'
{{ ',' if not loop.last else '' }}
{% set config = lookup('file', i.path) | from_yaml %}
{{ {'server': config.server, 'IP_subject_alt_name': config.IP_subject_alt_name} }}
{% endfor %}]
- name: Server address prompt
pause:
prompt: |
Select the server to update user list below:
Select the server to update user list below:
{% for r in server_list %}
{{ loop.index }}. {{ r }}
{% endfor %}
{{ loop.index }}. {{ r.server }} ({{ r.IP_subject_alt_name }})
{% endfor %}
register: _server
when: server is undefined

Expand All @@ -46,7 +44,7 @@
set_fact:
algo_server: >-
{% if server is defined %}{{ server }}
{%- elif _server.user_input %}{{ server_list[_server.user_input | int -1 ] }}
{%- elif _server.user_input %}{{ server_list[_server.user_input | int -1 ].server }}
{%- else %}omit{% endif %}
- name: Import host specific variables
Expand Down

0 comments on commit a66dbbf

Please sign in to comment.