@@ -102,32 +102,45 @@ discover_online(){
102102 log " info" " <discoverDomain><discover_online><exit> success"
103103}
104104
105- discover_infra_local (){
106- log " info" " <discoverDomain><discover_infra_local><entry> args: $* "
107- wls_inventory_file=$1
108- local file_timestamp=` date +%Y%m%d%H%M`
109- local SCRIPT_PATH=" $toolHome /bin/discoverInfra.sh"
110- local model_file_arg=" "
111- if [[ -f $wls_inventory_file ]]; then
112- model_file_arg=" -model_file $wls_inventory_file "
113- elif [[ -f " $toolHome /out/$wls_inventory_file " ]]; then
114- model_file_arg=" -model_file $toolHome /out/$wls_inventory_file "
115- else
116- log " error" " <discoverDomain><discover_infra_local><error> model_file $wls_inventory_file not found. exiting."
117- exit 2
118- fi
119- local ssh_args
120- ssh_args=$( get_ssh_args) # Get SSH options from helper
121- discover " local" " $SCRIPT_PATH " " $model_file_arg " " -archive_file $toolHome /out/infra_output_$file_timestamp .json" " $ssh_args "
122- exit_code=$?
123- log " info" " Executed discover infra with exit code [$exit_code ]"
124- if [ $exit_code -ne 0 ] && [ $exit_code -ne 1 ]; then
125- log " error" " <discoverDomain><discover_infra_local><error> Error executing discover infra"
126- exit $exit_code
127- fi
128- log " info" " <discoverDomain><discover_infra_local><exit> infrastructure_file : $toolHome /out/infra_output_$file_timestamp .json"
129- DISCOVERED_INFRA_JSON=" $toolHome /out/infra_output_$file_timestamp .json"
130- update_migration_data_json " infra_json" " $DISCOVERED_INFRA_JSON "
105+ discover_infra_local () {
106+ log " info" " <discoverDomain><discover_infra_local><entry> args: $* "
107+
108+ wls_inventory_file=" $1 "
109+ file_timestamp=$( date +%Y%m%d%H%M)
110+
111+ # Validate input file
112+ if [[ -f " $wls_inventory_file " ]]; then
113+ input_file=" $wls_inventory_file "
114+ elif [[ -f " $toolHome /out/$wls_inventory_file " ]]; then
115+ input_file=" $toolHome /out/$wls_inventory_file "
116+ else
117+ log " error" " <discoverDomain><discover_infra_local><error> model_file $wls_inventory_file not found. exiting."
118+ exit 2
119+ fi
120+
121+ # Output file
122+ output_file=" $toolHome /out/infra_output_${file_timestamp} .json"
123+
124+ # Python script for patching
125+ PYTHON_SCRIPT=" $toolHome /lib/python/patch_discover_infra_model.py"
126+
127+ # Call Python script to patch the model file
128+ log " info" " Executing patch_discover_infra_mode.py on $input_file "
129+ python3 " $PYTHON_SCRIPT " \
130+ --input_model " $input_file " \
131+ --output_model " $output_file " \
132+ --env_file " $ON_PREM_ENV_FILE "
133+ exit_code=$?
134+ log " info" " Executed Python patch script with exit code [$exit_code ]"
135+ if [[ $exit_code -ne 0 ]]; then
136+ log " error" " <discoverDomain><discover_infra_local><error> Python script failed"
137+ exit $exit_code
138+ fi
139+ log " info" " <discoverDomain><discover_infra_local><exit> infrastructure_file : $output_file "
140+
141+ # Update migration metadata
142+ DISCOVERED_INFRA_JSON=" $output_file "
143+ update_migration_data_json " infra_json" " $DISCOVERED_INFRA_JSON "
131144}
132145
133146discover_infra_remote (){
0 commit comments