Description
Ansible Role
sap_install_media_detect
OS Family
N/A
Ansible Controller - Python version
python --version
Python 3.11.13
Ansible-core version
ansible --version
ansible [core 2.16.14]
Bug Description
Issue
The sapfile
Bash script was updated in commit 63f1e74. However, the removal of the exit;
statement from the sap_export_nwas_java detection
block has introduced an issue. Specifically, the task SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Find the relevant non-extract subdirectories
now returns a duplicate result for the sap_export_nwas_java
directory. As a result, the subsequent task SAP Install Media Detect - Prepare - Move files to parent for known subdirs - Move files back to '{{ __sap_install_media_detect_software_main_directory }}'
attempts to move the same file twice. On the second attempt, the file is no longer in the source directory, which causes an error.
Problem
The Bash script always returns the result sap_export_nwas_java
if the sapfile detects a sap_export_nwas_java
even if we do not pass a directory.
$ ls -d $(/tmp/sapfile -s) 2>/dev/null
sap_export_nwas_java
If we pass the sap_export_nwas_java
directory like the command in the task, we have a duplicate result.
$ ls -d sap_export_nwas_java $(/tmp/sapfile -s) 2>/dev/null
sap_export_nwas_java sap_export_nwas_java
Solution
We can introduce a sort -u
to get a unique result of each items.
Bug reproduction
- Download the DATA_UNITS for SAP S/4HANA JAVA (Software Center > INSTALLATIONS & UPGRADES > By Alphabetical Index (A-Z) > S > SAP S/4HANA > choose the version > INSTALLATION AND UPGRADE > 5XXXXX.ZIP)
- Run the command
ls -d $(<path_sapfile> -s) 2>/dev/null
Community participation
Happy to implement this bug fix