Add uploadPpa function
Change-Id: I99cf5b8799c562efc123634f9a8b6e3fa832f856
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index ffa72d3..6a01a12 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -305,3 +305,23 @@
}
}
}
+
+/**
+ * Execute linux command and catch nth element
+ * @param cmd command to execute
+ * @param index index to retrieve
+ * @return index-th element
+ */
+
+def cutOrDie(cmd, index)
+{
+ def common = new com.mirantis.mk.Common()
+ def output
+ try {
+ output = sh(script: cmd, returnStdout: true)
+ def result = output.tokenize(" ")[index]
+ return result;
+ } catch (Exception e) {
+ common.errorMsg("Failed to execute cmd: ${cmd}\n output: ${output}")
+ }
+}
\ No newline at end of file