Fixes to documentation rsync copy job

Change-Id: I1644624a2ef950d9c9f92258bd8dda074c37de16
diff --git a/jjb/docs-legacy.yaml b/jjb/docs-legacy.yaml
index c8875ca..0884557 100644
--- a/jjb/docs-legacy.yaml
+++ b/jjb/docs-legacy.yaml
@@ -93,7 +93,17 @@
 
     builders:
       - shell: |
-          cd cord/build/docs
+          #!/usr/bin/env bash
+
+          # Set up the ssh host keys for the docs host
+          mkdir -p ~/.ssh
+          echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
+
+          # build the docs
+          cd cord/docs
           make build
-          rsync -rvzh --delete cord/docs/_book/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
-          rsync -rvzh --delete cord/docs/xos/swagger/ {docs-ssh-host}:/var/www/guide/$GERRIT_BRANCH
+
+          # copy swagger REST API docs first, then exclude deleting them when copying rest of guide
+          rsync -rvzh --delete _book/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH
+          rsync -rvzh --delete xos/swagger/ guide.opencord.org:/var/www/guide/$GERRIT_BRANCH/swagger
+