From 0f2d954b82e44d7bbd646e200510beb1ca3e469e Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Wed, 20 Feb 2013 17:51:19 -0600 Subject: [PATCH] Fix create_userrc.sh private key hang tools/create_userrc.sh hangs in a couple of mv commands now that private keys are created with mode 400. mv is prompting to override the permissions, so let's just -f it all. Change-Id: I8fbb24da6582edcff741653ffdf8bf683b79851a --- tools/create_userrc.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/create_userrc.sh b/tools/create_userrc.sh index 55cb8fac63..619d63f7ff 100755 --- a/tools/create_userrc.sh +++ b/tools/create_userrc.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash -#Warning: This script just for development purposes +# **create_userrc.sh** + +# Pre-create rc files and credentials for the default users. + +# Warning: This script just for development purposes ACCOUNT_DIR=./accrc @@ -164,12 +168,12 @@ function add_entry(){ local ec2_cert="$rcfile-cert.pem" local ec2_private_key="$rcfile-pk.pem" # Try to preserve the original file on fail (best effort) - mv "$ec2_private_key" "$ec2_private_key.old" &>/dev/null - mv "$ec2_cert" "$ec2_cert.old" &>/dev/null + mv -f "$ec2_private_key" "$ec2_private_key.old" &>/dev/null + mv -f "$ec2_cert" "$ec2_cert.old" &>/dev/null # It will not create certs when the password is incorrect if ! nova --os-password "$user_passwd" --os-username "$user_name" --os-tenant-name "$tenant_name" x509-create-cert "$ec2_private_key" "$ec2_cert"; then - mv "$ec2_private_key.old" "$ec2_private_key" &>/dev/null - mv "$ec2_cert.old" "$ec2_cert" &>/dev/null + mv -f "$ec2_private_key.old" "$ec2_private_key" &>/dev/null + mv -f "$ec2_cert.old" "$ec2_cert" &>/dev/null fi cat >"$rcfile" <