From 96aaeac2a00986682aee287e642772d2b0b69990 Mon Sep 17 00:00:00 2001 From: "Rodrigo D. Lopez" <19981369+RodrigoDLopez@users.noreply.github.com> Date: Fri, 16 Dec 2022 13:21:44 -0300 Subject: [PATCH] Fixes script that perform change password on hosts (#6783) Co-authored-by: Lopez --- scripts/vm/hypervisor/update_host_passwd.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/vm/hypervisor/update_host_passwd.sh b/scripts/vm/hypervisor/update_host_passwd.sh index 9dfc5a900f1..f1e469ccaec 100755 --- a/scripts/vm/hypervisor/update_host_passwd.sh +++ b/scripts/vm/hypervisor/update_host_passwd.sh @@ -15,14 +15,16 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - username=$1 new_passwd=$2 -expected="successfully." -result=`echo -e "$new_passwd\n$new_passwd" | passwd --stdin $username | grep successfully | awk '{ print $6 }'` -if [ $result = $expected ]; then +passwd ${username} << EOD +${new_passwd} +${new_passwd} +EOD + +if [[ $(echo $?) -eq 0 ]]; then exit 0 else exit 1 -fi \ No newline at end of file +fi