Skip to content

Commit 2773710

Browse files
committed
Address review: add eviction_strategy input validation
- Add (String) type hint to the comment to clarify quoting is required - Add note that unquoted None becomes null under JINJA2_NATIVE=true - Create validations/kubevirt_vm.yml to assert the variable is a valid string and one of 'None' or 'LiveMigrate' before module execution
1 parent 09e50f4 commit 2773710

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

roles/sap_vm_provision/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ sap_vm_provision_kubevirt_vm_os_user_password: ""
822822
# RAM Overhead [GiB] for virt-launcher container, this can be small for VMs < 1 TB and without SRIOV but should be increased to 16 or more for VMs > 1TB
823823
sap_vm_provision_kubevirt_vm_container_memory_overhead: 1
824824

825-
# Eviction strategy for KubeVirt VMs.
825+
# Eviction strategy for KubeVirt VMs (String).
826826
# Set to 'None' for local storage (ReadWriteOnce PVCs) or 'LiveMigrate' for shared storage (ReadWriteMany).
827827
sap_vm_provision_kubevirt_vm_eviction_strategy: "None"
828828

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
---
3+
4+
- name: Assert that the variable 'sap_vm_provision_kubevirt_vm_eviction_strategy' is defined as valid string
5+
ansible.builtin.assert:
6+
that:
7+
- sap_vm_provision_kubevirt_vm_eviction_strategy is defined
8+
- sap_vm_provision_kubevirt_vm_eviction_strategy is string
9+
- sap_vm_provision_kubevirt_vm_eviction_strategy in ['None', 'LiveMigrate']
10+
fail_msg: |
11+
The variable 'sap_vm_provision_kubevirt_vm_eviction_strategy' is undefined or invalid.
12+
It should be one of: 'None' for local storage (ReadWriteOnce PVCs) or 'LiveMigrate' for shared storage (ReadWriteMany).

0 commit comments

Comments
 (0)