diff --git a/client/patchman-client b/client/patchman-client index c53e6611..5649cca2 100755 --- a/client/patchman-client +++ b/client/patchman-client @@ -196,21 +196,28 @@ get_enabled_modules() { | grep -v ^Hint \ | awk {'print $1'}) - OLDIFS=${IFS} - IFS=" -" for module in ${enabled_modules} ; do - IFS=${OLDIFS} - module_info=$(yum module info ${module}) - module_arch=$(echo ${module_info} | grep Architecture | cut -d : -f 2 | awk '{$1=$1};1') - module_repo=$(echo ${module_info} | grep Repo | cut -d : -f 2 | awk '{$1=$1};1') - module_stream=$(echo ${module_info} | grep Stream | cut -d : -f 2 | sed -e 's/ \[.*//g' | awk '{$1=$1};1') - module_version=$(echo ${module_info} | grep Version | cut -d : -f 2 | awk '{$1=$1};1') - module_context=$(echo ${module_info} | grep Context | cut -d : -f 2 | awk '{$1=$1};1') - module_packages=$(echo ${module_info} | sed -n '/Artifacts/,$p' | grep -v Hint | sed -e 's/.* : //g' | grep -v ^$) + modules_info=$(yum module info ${module} | grep -v ^Hint) + unset x + while read -r line ; do + if [ -z "$line" ] ; then + echo -e ${x} | grep -q -E "^Stream.*\[e\]" && break || unset x + else + x="$x$line\n" + fi + done < <(echo -n "${modules_info}") + module_info=$(echo -e ${x}) + module_arch=$(echo "${module_info}" | grep ^Architecture | cut -d : -f 2 | awk '{$1=$1};1') + module_repo=$(echo "${module_info}" | grep ^Repo | cut -d : -f 2 | awk '{$1=$1};1') + module_stream=$(echo "${module_info}" | grep ^Stream | cut -d : -f 2 | sed -e 's/ \[.*//g' | awk '{$1=$1};1') + module_version=$(echo "${module_info}" | grep ^Version | cut -d : -f 2 | awk '{$1=$1};1') + module_context=$(echo "${module_info}" | grep ^Context | cut -d : -f 2 | awk '{$1=$1};1') + module_packages=$(echo "${module_info}" | sed -n '/Artifacts/,$p' | sed -e 's/.* *: //g' | grep -v ^$) + OLDIFS=${IFS} IFS=" " + module_package_str="" for package in ${module_packages} ; do module_package_str="${module_package_str} '${package}'" done