From 652ac5d61f878ebca697a6a08cb7799f7351c2e5 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Tue, 5 May 2026 14:26:04 -0400 Subject: [PATCH] fix regex --- salt/orch/delete_hypervisor.sls | 2 +- salt/orch/vm_pillar_clean.sls | 2 +- salt/reactor/check_hypervisor.sls | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/orch/delete_hypervisor.sls b/salt/orch/delete_hypervisor.sls index 784977e28..45e17a74a 100644 --- a/salt/orch/delete_hypervisor.sls +++ b/salt/orch/delete_hypervisor.sls @@ -5,7 +5,7 @@ {% set hypervisor = pillar.get('minion_id', '') %} -{% if not hypervisor|regex_match('^[A-Za-z0-9._-]{1,253}$') %} +{% if not hypervisor|regex_match('^([A-Za-z0-9._-]{1,253})$') %} {% do salt.log.error('delete_hypervisor_orch: refusing unsafe minion_id=' ~ hypervisor) %} delete_hypervisor_invalid_minion_id: test.fail_without_changes: diff --git a/salt/orch/vm_pillar_clean.sls b/salt/orch/vm_pillar_clean.sls index 9b6bf1ee5..57612bbd4 100644 --- a/salt/orch/vm_pillar_clean.sls +++ b/salt/orch/vm_pillar_clean.sls @@ -14,7 +14,7 @@ {% do salt.log.debug('vm_pillar_clean_orch: Running') %} {% set vm_name = pillar.get('vm_name', '') %} -{% if not vm_name|regex_match('^[A-Za-z0-9._-]{1,253}$') %} +{% if not vm_name|regex_match('^([A-Za-z0-9._-]{1,253})$') %} {% do salt.log.error('vm_pillar_clean_orch: refusing unsafe vm_name=' ~ vm_name) %} vm_pillar_clean_invalid_name: test.fail_without_changes: diff --git a/salt/reactor/check_hypervisor.sls b/salt/reactor/check_hypervisor.sls index c0fa49ddc..da81e0d5f 100644 --- a/salt/reactor/check_hypervisor.sls +++ b/salt/reactor/check_hypervisor.sls @@ -4,7 +4,7 @@ # Elastic License 2.0. {% set hid = data['id'] %} -{% if hid|regex_match('^[A-Za-z0-9._-]{1,253}$') +{% if hid|regex_match('^([A-Za-z0-9._-]{1,253})$') and hid.endswith('_hypervisor') and data['result'] == True %}