Fixing the ssh key option in create_config_drive.sh

Change-Id: I3b4abfc80a955be6990ff4d0809445c07bc8e3d5
diff --git a/config-drive/create_config_drive.sh b/config-drive/create_config_drive.sh
index d8ae698..b30e644 100644
--- a/config-drive/create_config_drive.sh
+++ b/config-drive/create_config_drive.sh
@@ -64,10 +64,6 @@
 config_image=$1
 shift
 
-if [ "$ssh_key" ] && [ -f "$ssh_key" ]; then
-        echo "adding pubkey from $ssh_key"
-        ssh_key_data=$(cat "$ssh_key")
-fi
 
 uuid=$(uuidgen)
 if ! [ "$hostname" ]; then
@@ -77,6 +73,11 @@
 trap 'rm -rf $config_dir' EXIT
 config_dir=$(mktemp -t -d configXXXXXX)
 
+if [ "$ssh_key" ] && [ -f "$ssh_key" ]; then
+        echo "adding pubkey from $ssh_key"
+        cp $ssh_key $config_dir/root_auth_keys
+fi
+
 if [ "$user_data" ] && [ -f "$user_data" ]; then
         echo "adding user data from $user_data"
         cp $user_data $config_dir/user-data