Skip to content

Instantly share code, notes, and snippets.

@xlcommunity
xlcommunity / load-into-dict.cli
Last active August 29, 2015 14:16
Importing a properties file into a dictionary
# 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 java.util import HashSet
from java.util import Properties
from java.io import FileReader
def loadProps(propertiesFile):
props = Properties()
@xlcommunity
xlcommunity / deployit.conf
Last active August 29, 2015 14:16
Install Deployit as a Windows Service
# 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.
{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural
@xlcommunity
xlcommunity / wrapper-yajsw-xlr.conf
Last active August 29, 2015 14:16
Install XL Release as a Windows Service
# 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.
# WARNING - Do not modify any of the properties when an application
# using this configuration file has been installed as a service or daemon.
# Please uninstall the service before modifying this file. The
# service must then be reinstalled.
JAVA_HOME=C:\\Program Files\\Java\\jre7
@xlcommunity
xlcommunity / wrapper.conf
Last active August 29, 2015 14:16
Install Deployit as a Windows Service
# 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.
# WARNING - Do not modify any of the properties when an application
# using this configuration file has been installed as a service or daemon.
# Please uninstall the service before modifying this file. The
# service must then be reinstalled.
JAVA_HOME=D:\\Java\\jre6
@xlcommunity
xlcommunity / import-export-dictionaries.cli
Last active August 29, 2015 14:16
Importing a properties file into a dictionary
# 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 java.util import HashSet
from java.util import Properties
from java.io import FileReader
from java.io import FileWriter
def loadProps(propertiesFile):
@xlcommunity
xlcommunity / publish-package.py
Created March 12, 2015 08:33
Integrating TeamCity with Deployit
#######################################################################
# NOTICE: This script is provided as a sample only, with no warranty
# expressed or implied, and is not supported by XebiaLabs.
#######################################################################
import sys
packagePath = sys.argv.pop(1)
print "Importing '%s'" % (packagePath)
deployit.importPackage(packagePath)
@xlcommunity
xlcommunity / mig.py
Last active August 29, 2015 14:16
Migrating an (extended) deployable and deployed CI to a new defined deployable and deployed CI
# 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.
# Levent Tutar
# ltutar@xebia.com
# If the deployable is not deployed,
# then you can delete it and recreate it with the new type
@xlcommunity
xlcommunity / cleanup-repository.py
Last active August 29, 2015 14:16
Periodically cleaning the repository with a CLI script
# 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 java.util import Calendar
import sys
def isWantedApplication(packageId):
if application is None:
return True
@xlcommunity
xlcommunity / deployitd
Last active August 29, 2015 14:16
Sample service wrapper for Deployit on RHEL/CentOS
# 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.
#!/bin/sh
# Starts and stops script
# For Running from Jenkins, use the following command to avoid hang behavior
# ssh username@server 'cd | nohup ./deployitd start > foo.out 2> foo.err < /dev/null &'
#
# deployitd - Startup Script for deployit#
@xlcommunity
xlcommunity / searchRepo.py
Last active August 29, 2015 14:16
Searching Applications, Environments and Hosts using CLI
# 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 com.xebialabs.deployit.plugin.api.reflect import Type
def findApp(appNameCriteria):
apps = proxies.getRepository().query(Type.valueOf("udm.Application"), None, appNameCriteria, None, None, 0, -1)
apps = [str(appName.id) for appName in apps if appName.id.startswith("Application")]
if apps: