You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/12/02 08:20:00 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6783: Fixes script that perform change password on hosts

DaanHoogland commented on code in PR #6783:
URL: https://github.com/apache/cloudstack/pull/6783#discussion_r1037888028


##########
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

Review Comment:
   I donĀ“t mind this part, but just letting the script exit will have all but the same effect; $? will be the exit code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org