fix: Fix server selection in update-user while preserving nice display of server along with its alt_name in the list (#14727)

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.

Co-authored-by: Jack Ivanov <17044561+jackivanov@users.noreply.github.com>
master
Roch Moreau 3 months ago committed by GitHub
parent da32bafd2d
commit 346437fa6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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
@ -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

Loading…
Cancel
Save