Skip to content

Instantly share code, notes, and snippets.

@xlcommunity
xlcommunity / Windows.py
Last active Aug 29, 2015
Configuring the XL Release Windows Remote Script task to use WINRM_NATIVE (i.e. winrs)
View Windows.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 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 -
View JiraConnectivityCheckTask.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
if jiraServer is None:
print "No server provided."
sys.exit(1)
jiraURL = jiraServer['url']
View StripHashFromXldServerDefinition.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
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')
View 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 Aug 29, 2015
RemotePowerShellTask.py
View 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 / bulkExportTemplates.sh
Last active Nov 3, 2022
Small set of utilities to get/export/import templates from XL Release servers.
View bulkExportTemplates.sh
#!/bin/bash
#####################################################################################################
#
# 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.
#
#####################################################################################################
@xlcommunity
xlcommunity / releases-templates-trigger-count.py
Last active Aug 29, 2015
Python script to count releases, templates and triggers in XL Release
View releases-templates-trigger-count.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 httplib
import unittest
import urllib2
import base64
import sys
import json
@xlcommunity
xlcommunity / samplePackageImport.py
Last active Aug 29, 2015
Dynamically creating a DAR based on files in a directory
View samplePackageImport.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
import os
from org.jdom2 import Element, Text, Document
from org.jdom2.output import XMLOutputter
import re
from java.io import File, FileInputStream, FileOutputStream
@xlcommunity
xlcommunity / server-cleanup.py
Created Mar 12, 2015
Using rules to interact with WebSphere cluster members
View server-cleanup.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.
### rules/server-cleanup.py
# Funtion to find the hosts in a WebSphere Custer
def findHosts(container):
hosts = []
ctype = str(container.type)
if ctype == "was.ManagerServer":