Add functions to work with mirror.mirantis.com

This patch adds library to work with mirror.mirantis.com
 * getLatestSnapshotMeta function is added

Change-Id: I7c53f3f6258721475de91c0a5708341da0529c2f
Related-Prod: PROD-25648
diff --git a/src/com/mirantis/mk/Mirror.groovy b/src/com/mirantis/mk/Mirror.groovy
new file mode 100644
index 0000000..a13f1b7
--- /dev/null
+++ b/src/com/mirantis/mk/Mirror.groovy
@@ -0,0 +1,34 @@
+package com.mirantis.mk
+
+/**
+ *
+ * Functions to work with mirror.mirantis.com
+ *
+ */
+
+/**
+ * Returns latest meta for latest available snapshot
+ *
+ * @param host          mirror host
+ * @param version       version of components (nightly|testing|stable|release-x)
+ * @param component     component name (salt-formulas)
+ * @param distribution  ubuntu distribution to get repo for (xenial by default)
+ */
+def getLatestSnapshotMeta(host, version, component, distribution='xenial') {
+  common = new com.mirantis.mk.Common()
+
+  def repoUrl = "http://${host}/${version}/${component}/${distribution}.target.txt"
+  def res
+  def snapshotName
+  def meta = [:]
+
+  res = common.shCmdStatus("curl ${repoUrl}")
+  // Return multiple lines where first one is the latest snapshot
+  // ../../.snapshots/nightly-salt-formulas-xenial-2018-12-10-204157
+  snapshotName = res['stdout'].split("\n")[0].tokenize('/').last().trim()
+
+  meta['repoUrl'] = "http://${host}/.snapshots/${snapshotName}"
+  meta['repoName'] = snapshotName
+
+  return meta
+}