Refactor dumpPublishes function

Change-Id: Iba8759288bca90f17e239892ef41d98ccfe8c1d0
diff --git a/src/com/mirantis/mk/Aptly.groovy b/src/com/mirantis/mk/Aptly.groovy
index 651b71a..d50df24 100644
--- a/src/com/mirantis/mk/Aptly.groovy
+++ b/src/com/mirantis/mk/Aptly.groovy
@@ -91,7 +91,7 @@
     if (dump_publish) {
         def now = new Date();
         def timestamp = now.format("yyyyMMddHHmmss", TimeZone.getTimeZone('UTC'));
-        dumpPublishes(server, ".", timestamp, target)
+        dumpPublishes(server, timestamp, target)
     }
 
     sh("aptly-publisher --url ${server} promote --source ${source} --target ${target} --force-overwrite ${opts}")
@@ -114,9 +114,9 @@
  * @param prefix        Prefix of dump files
  * @param opts          Options: debug, timeout, ...
  */
-def dumpPublishes(server, saveDir, prefix, publishes='all', opts='-d --timeout 600') {
-    sh("aptly-publisher dump --url ${server} --save-dir ${saveDir} --prefix ${prefix} ${opts}")
-    archiveArtifacts artifacts: "${saveDir}/${prefix}*"
+def dumpPublishes(server, prefix, publishes='all', opts='-d --timeout 600') {
+    sh("aptly-publisher dump --url ${server} --save-dir . --prefix ${prefix} --p ${publishes} ${opts}")
+    archiveArtifacts artifacts: "${prefix}*"
 }
 
 /**