[Gerrit] Do not create account if already exists
* In case of redeployment invokation of this method may lead to deploy failure. It will try to create an account which probably already exists. So the right solution here to check whether this user exists or not and set related properties (public key and email) to it without user creation. Change-Id: Ia7950e822da2e12b525577df507e7cc9912fca56
This commit is contained in:
parent
1258e407b7
commit
f79af2b6c1
@ -14,5 +14,14 @@ NAME="$6"
|
||||
|
||||
HOSTNAME="`hostname -f`"
|
||||
|
||||
su gerrit2 -c "ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key project-creator@$HOSTNAME "`
|
||||
`"gerrit create-account --group \'${GROUP}\' --full-name \'${FULL_NAME}\' --email $EMAIL --ssh-key \'${SSHKEY}\' $NAME"
|
||||
set +e
|
||||
su gerrit2 -c "ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key project-creator@$HOSTNAME \
|
||||
gerrit create-account --group \'${GROUP}\' --full-name \'${FULL_NAME}\' --email $EMAIL --ssh-key \'${SSHKEY}\' $NAME"
|
||||
|
||||
code=$?
|
||||
|
||||
if [ $code -ne 0 ]; then
|
||||
# Do not create account but set related properties.
|
||||
su gerrit2 -c "ssh -p 29418 -i /home/gerrit2/review_site/etc/ssh_project_rsa_key project-creator@$HOSTNAME \
|
||||
gerrit set-account --full-name \'${FULL_NAME}\' --add-email $EMAIL --add-ssh-key \'${SSHKEY}\' $NAME"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user