diff options
author | Clark Laughlin <clark.laughlin@linaro.org> | 2015-04-15 10:56:42 +0000 |
---|---|---|
committer | Clark Laughlin <clark.laughlin@linaro.org> | 2015-04-15 10:56:42 +0000 |
commit | e260729b381233b93692115db7c538ba53c9b519 (patch) | |
tree | e4e439a6f1ac19500236fa4e1f073b1ffd8e8770 | |
parent | fda8f9c2ede11854f223e749ece94db0b0abbe62 (diff) |
do not recreate keys if they already exist
-rwxr-xr-x | cloud-deploy/5-setup-network-and-keys.sh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cloud-deploy/5-setup-network-and-keys.sh b/cloud-deploy/5-setup-network-and-keys.sh index ab49e82..41cffde 100755 --- a/cloud-deploy/5-setup-network-and-keys.sh +++ b/cloud-deploy/5-setup-network-and-keys.sh @@ -12,9 +12,14 @@ juju ssh nova-cloud-controller/0 ". ./stackrc ; nova quota-class-show default ; juju ssh nova-cloud-controller/0 ". ./stackrc ; for i in {1..50} ; do nova floating-ip-create default ; done" -rm ./keypair* -ssh-keygen -t rsa -N '' -f ./keypair -juju scp keypair.pub nova-cloud-controller/0:~ -juju ssh nova-cloud-controller/0 ". ./stackrc ; nova keypair-add --pub-key keypair.pub default-key ; nova keypair-list" -# juju ssh nova-cloud-controller/0 ". ./stackrc ; nova keypair-add --pub-key keypair.pub jenkins ; nova keypair-list" +keypair_file=./keypair +if [ -f "${keypair_file}*" ] +then + echo "keypair already exists - not creating again" +else + ssh-keygen -t rsa -N '' -f ${keypair_file} +fi + +juju scp ${keypair_file}.pub nova-cloud-controller/0:~ +juju ssh nova-cloud-controller/0 ". ./stackrc ; nova keypair-add --pub-key ${keypair_file}.pub default-key ; nova keypair-list" |