Fixes script that perform change password on hosts (#6783)

Co-authored-by: Lopez <rodrigo@scclouds.com.br>
This commit is contained in:
Rodrigo D. Lopez 2022-12-16 13:21:44 -03:00 committed by GitHub
parent 239e9dd861
commit 96aaeac2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
fi