Skip to content

Instantly share code, notes, and snippets.

@xlcommunity
xlcommunity / CsvExportHook.py
Created July 28, 2015 01:04
acme.CsvExportHook example
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
import os
def stripApplication(releaseId):
return releaseId.replace('Applications/', '')
@xlcommunity
xlcommunity / CustomNotification.py
Last active August 29, 2015 14:24
Example custom notification task
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
#
import sys
from org.apache.commons.mail import EmailException, SimpleEmail
SOCKET_TIMEOUT = 30000 # 30s
@xlcommunity
xlcommunity / HttpRequest-snippet.py
Created June 30, 2015 12:15
HttpRequest modified to support PATCH
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
...
from org.apache.http.client.config import RequestConfig
# HttpPatch added here
from org.apache.http.client.methods import HttpGet, HttpPost, HttpPut, HttpPatch, HttpDelete
...
@xlcommunity
xlcommunity / Windows.py
Last active August 29, 2015 14:23
Configuring the XL Release Windows Remote Script task to use WINRM_NATIVE (i.e. winrs)
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
import sys
from com.xebialabs.xlrelease.plugin.overthere import WinrmRemoteScript
# adding these imports
from com.xebialabs.overthere.cifs import CifsConnectionBuilder
from com.xebialabs.overthere.cifs import CifsConnectionType
# this subclass of WinrmRemoteScript stores the two new properties -
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
import sys
if jiraServer is None:
print "No server provided."
sys.exit(1)
jiraURL = jiraServer['url']
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
import sys
import com.xhaus.jyson.JysonCodec as json
xlr_server_info = {'url': 'http://localhost:5516', 'username': 'admin', 'password': 'secret' }
xlrserver = HttpRequest(xlr_server_info)
response = xlrserver.get('/deployit/servers', contentType = 'application/json')
@xlcommunity
xlcommunity / ExampleRepositoryEventListener.class
Last active August 29, 2015 14:20
ExampleRepositoryEventListener.java
@xlcommunity
xlcommunity / RemoteScript.py
Created April 10, 2015 15:48
RemoteScript.py
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
from __future__ import with_statement
from overtherepy import OverthereHostSession, SshConnectionOptions, OverthereHost, StringUtils
import sys
host = OverthereHost(SshConnectionOptions(hostAddress, username, privateKey=privateKey))
#logging must be turned of for use in XLR
@xlcommunity
xlcommunity / RemotePowerShellTask.py
Last active August 29, 2015 14:18
RemotePowerShellTask.py
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
import sys
from java.lang import Exception
from java.io import PrintWriter
from java.io import StringWriter
from com.xebialabs.overthere import CmdLine, ConnectionOptions, OperatingSystemFamily, Overthere
@xlcommunity
xlcommunity / releases-templates-trigger-count.py
Last active August 29, 2015 14:17
Python script to count releases, templates and triggers in XL Release
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
import httplib
import unittest
import urllib2
import base64
import sys
import json