diff --git a/.travis.yml b/.travis.yml
index 512d004..8e25c91 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ deploy:
provider: releases
api_key:
secure: aoVXZyLOBmB4Q2lLKLaqEN8zcqN3K3/3agRBA1znM1PLeqXSE3CwQe6sHkX6BrfMoDDtjqeepDMgJ9TsqJFq+lPY+HuVFzOqGlrWlIZHBUKI3hmfjgM/61CkdK2eBO42Ym4tqCQ4L1Tp42fcrB6M/a/0TGI5ENW2bJk8+ofRT8M=
- file: build/libs/xlr-xldeploy-plugin-3.0.0.jar
+ file: build/libs/xlr-xldeploy-plugin-3.1.0.jar
skip_cleanup: true
on:
all_branches: true
diff --git a/README.md b/README.md
index 457895d..f1817f5 100644
--- a/README.md
+++ b/README.md
@@ -138,6 +138,14 @@ returned package ID
`WINDOWSWINRM_NATIVE
${address}`
* `addToEnvironment` - Switch to decide if to add the CI to an environment
* `envID` - Environment to add the CI to.
+
++ Delete CI
+ * `server` - Server to query
+ * `username` - Override username
+ * `password` - Override password
+ * `ciID` - ID of the Configuration Item you want to delete
+ * `envID` - If provided, will remove the CI from an Environment first
+ * `throwOnFail` - Boolean - If True, the Task will fail if the Deletion does not succeed.
+ Delete Infrastructure - This task will delete the specified Infrastructure CI, AND will also undeploy any deployed applications on the infrastrucutre as well as remove the infrastructure from any environments where it is referenced as a container.
* `server` - Server to query
diff --git a/build.gradle b/build.gradle
index 6a8c620..48fbe1d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,7 +3,7 @@ plugins {
id "com.xebialabs.xl.docker" version "1.1.0"
}
-version = "3.0.0"
+version = "3.1.0"
apply plugin: 'java'
apply plugin: 'idea'
diff --git a/src/main/resources/synthetic.xml b/src/main/resources/synthetic.xml
index cb0c54b..fc4b235 100644
--- a/src/main/resources/synthetic.xml
+++ b/src/main/resources/synthetic.xml
@@ -11,13 +11,15 @@
-->
+ xsi:schemaLocation="http://www.xebialabs.com/deployit/synthetic synthetic.xsd"
+ xmlns="http://www.xebialabs.com/deployit/synthetic">
-
+
@@ -102,7 +104,8 @@
description="If marked true and a package with the same ID already exists on the destination server, this will overwrite it. If false, it will throw an error."/>
-
+
@@ -132,7 +135,8 @@
-
@@ -141,7 +145,8 @@
-
+
@@ -171,7 +176,10 @@
description="Deletes a CI after optionally removing it from an environment">
-
+
+
-
+
0
+ if query_task_response.getResponse().find('true') > 0:
+ return True
+ if throw_on_fail:
+ raise Exception("CI with id [%s] does not exist." % ci_id)
+ return False
def create_directory(self, ci_id):
self.create_ci(ci_id, 'core.Directory')
@@ -394,7 +405,10 @@ def update_ci(self, ci_id, data, content_type):
def delete_ci(self, ci_id):
delete_task = '/deployit/repository/ci/' + ci_id
- self.http_request.delete(delete_task)
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}
+ response = self.http_request.delete(delete_task, headers=headers)
+ check_response(response, "Failed to delete ci with id [%s]. Server return [%s], with content [%s]" % (
+ ci_id, response.status, response.response))
def get_ci_tree(self, ci_id):
infrastructure_list = [ci_id]
diff --git a/src/main/resources/xlr_xldeploy/deleteCITask.py b/src/main/resources/xlr_xldeploy/deleteCITask.py
index b464fb7..d2bd05b 100644
--- a/src/main/resources/xlr_xldeploy/deleteCITask.py
+++ b/src/main/resources/xlr_xldeploy/deleteCITask.py
@@ -12,9 +12,10 @@
from xlr_xldeploy.XLDeployClientUtil import XLDeployClientUtil
-xldClient = XLDeployClientUtil.create_xldeploy_client(xldeployServer, username, password)
+xld_client = XLDeployClientUtil.create_xldeploy_client(xldeployServer, username, password)
+xld_client.check_ci_exist(ciID, throwOnFail)
if envID:
- xldClient.remove_ci_from_environment(envID,ciID)
+ xld_client.remove_ci_from_environment(envID, ciID)
-xldClient.delete_ci(ciID)
+xld_client.delete_ci(ciID)