Skip to content

Commit 346437f

Browse files
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 <[email protected]>
1 parent da32baf commit 346437f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: users.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,17 @@
2525
set_fact:
2626
server_list: >-
2727
[{% for i in _configs_list.files %}
28-
{% set config = lookup('file', i.path)|from_yaml %}
29-
'{{ config.server }}'
30-
'{{ config.IP_subject_alt_name }}'
31-
{{ ',' if not loop.last else '' }}
28+
{% set config = lookup('file', i.path) | from_yaml %}
29+
{{ {'server': config.server, 'IP_subject_alt_name': config.IP_subject_alt_name} }}
3230
{% endfor %}]
3331
3432
- name: Server address prompt
3533
pause:
3634
prompt: |
37-
Select the server to update user list below:
35+
Select the server to update user list below:
3836
{% for r in server_list %}
39-
{{ loop.index }}. {{ r }}
40-
{% endfor %}
37+
{{ loop.index }}. {{ r.server }} ({{ r.IP_subject_alt_name }})
38+
{% endfor %}
4139
register: _server
4240
when: server is undefined
4341

@@ -46,7 +44,7 @@
4644
set_fact:
4745
algo_server: >-
4846
{% if server is defined %}{{ server }}
49-
{%- elif _server.user_input %}{{ server_list[_server.user_input | int -1 ] }}
47+
{%- elif _server.user_input %}{{ server_list[_server.user_input | int -1 ].server }}
5048
{%- else %}omit{% endif %}
5149
5250
- name: Import host specific variables

0 commit comments

Comments
 (0)