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
... | ... |
@@ -1,6 +1,10 @@ |
1 | 1 |
#!/usr/bin/env bash |
2 | 2 |
|
3 |
-#Warning: This script just for development purposes |
|
3 |
+# **create_userrc.sh** |
|
4 |
+ |
|
5 |
+# Pre-create rc files and credentials for the default users. |
|
6 |
+ |
|
7 |
+# Warning: This script just for development purposes |
|
4 | 8 |
|
5 | 9 |
ACCOUNT_DIR=./accrc |
6 | 10 |
|
... | ... |
@@ -164,12 +168,12 @@ function add_entry(){ |
164 | 164 |
local ec2_cert="$rcfile-cert.pem" |
165 | 165 |
local ec2_private_key="$rcfile-pk.pem" |
166 | 166 |
# Try to preserve the original file on fail (best effort) |
167 |
- mv "$ec2_private_key" "$ec2_private_key.old" &>/dev/null |
|
168 |
- mv "$ec2_cert" "$ec2_cert.old" &>/dev/null |
|
167 |
+ mv -f "$ec2_private_key" "$ec2_private_key.old" &>/dev/null |
|
168 |
+ mv -f "$ec2_cert" "$ec2_cert.old" &>/dev/null |
|
169 | 169 |
# It will not create certs when the password is incorrect |
170 | 170 |
if ! nova --os-password "$user_passwd" --os-username "$user_name" --os-tenant-name "$tenant_name" x509-create-cert "$ec2_private_key" "$ec2_cert"; then |
171 |
- mv "$ec2_private_key.old" "$ec2_private_key" &>/dev/null |
|
172 |
- mv "$ec2_cert.old" "$ec2_cert" &>/dev/null |
|
171 |
+ mv -f "$ec2_private_key.old" "$ec2_private_key" &>/dev/null |
|
172 |
+ mv -f "$ec2_cert.old" "$ec2_cert" &>/dev/null |
|
173 | 173 |
fi |
174 | 174 |
cat >"$rcfile" <<EOF |
175 | 175 |
# you can source this file |