Edited methods restCall, publishArtifactoryHelmChart, deleteArtifactoryHelmChart and added restPut2 for Artifactory.groovy
Related-prod: https://mirantis.jira.com/browse/PROD-31522
Change-Id: I342ee77c0b74354b8c60803ef4235af0e3364bdc
diff --git a/src/com/mirantis/mk/Artifactory.groovy b/src/com/mirantis/mk/Artifactory.groovy
index 73ed80f..f436508 100644
--- a/src/com/mirantis/mk/Artifactory.groovy
+++ b/src/com/mirantis/mk/Artifactory.groovy
@@ -9,14 +9,20 @@
/**
* Make generic call using Artifactory REST API and return parsed JSON
*
- * @param art Artifactory connection object
- * @param uri URI which will be appended to artifactory server base URL
+ * @param art Artifactory connection object
+ * @param uri URI which will be appended to artifactory server base URL
* @param method HTTP method to use (default GET)
* @param data JSON data to POST or PUT
* @param headers Map of additional request headers
+ * @param prefix Default prefix "/api"
*/
+<<<<<<< HEAD
def restCall(art, uri, method = 'GET', data = null, headers = [:]) {
def connection = new URL("${art.url}/api${uri}").openConnection()
+=======
+def restCall(art, uri, method = 'GET', data = null, headers = [:], prefix = '/api') {
+ def connection = new URL("${art.url}${prefix}${uri}").openConnection()
+>>>>>>> 32c5611... Edited methods restCall, publishArtifactoryHelmChart, deleteArtifactoryHelmChart and added restPut2 for Artifactory.groovy
if (method != 'GET') {
connection.setRequestMethod(method)
}
@@ -84,6 +90,18 @@
}
/**
+ * Make PUT request using Artifactory REST API and return parsed JSON
+ *
+ * @param art Artifactory connection object
+ * @param uri URI which will be appended to artifactory server base URL
+ * @param data JSON Data to PUT
+ * @param prefix Default prefix "/api"
+ */
+def restPut2(art, uri, prefix, data = null) {
+ return restCall(art, uri, 'PUT', data, ['Accept': '*/*'], prefix)
+
+
+/**
* Make DELETE request using Artifactory REST API
*
* @param art Artifactory connection object
@@ -444,7 +462,11 @@
* @param chartName Chart name
*/
def publishArtifactoryHelmChart(art, repoName, chartName){
+<<<<<<< HEAD
return restPut(art, "/repositories/${repoName}", "${chartName}")
+=======
+ return restPut2(art, "/${repoName}", "${chartName}")
+>>>>>>> 32c5611... Edited methods restCall, publishArtifactoryHelmChart, deleteArtifactoryHelmChart and added restPut2 for Artifactory.groovy
}
/**