Skip to content

Instantly share code, notes, and snippets.

View bmoussaud's full-sized avatar
😀

Benoit Moussaud bmoussaud

😀
View GitHub Profile
module=$1
echo "remove submodule $module"
git submodule deinit $module
git rm $module
rm -rf .git/modules/$module
@bmoussaud
bmoussaud / step.py
Created August 17, 2015 12:12
get steps information using the CLI
def gather_steps_from_block(b, tid):
if hasattr(b, "blocks") and len(b.blocks):
for i in b.blocks:
return gather_steps_from_block(i, tid)
else:
step_block_state = task2.steps(tid, b.id)
step_index = 0
step_ids = []
for st in step_block_state.steps:
step_index += 1
@bmoussaud
bmoussaud / patch.sh
Created August 29, 2012 13:12
Deployit: Patch an existing file during a deployment
echo "patching ${deployed.configurationFile}"
touch snippet.conf
echo "${deployed.comment} ${deployed.beginMarkup}" >> snippet.conf
echo "aValue ${deployed.avalue}" >> snippet.conf
echo "anotherValue ${deployed.anotherValue}" >> snippet.conf
echo "${deployed.comment} ${deployed.endMarkup}" >> snippet.conf
@bmoussaud
bmoussaud / dictionary.py
Created September 21, 2012 09:49
Deployit: Create or Update a dictionary from a property file
from java.io import File
from java.io import FileInputStream
from java.util import Properties
#Load properties file in java.util.Properties
def loadPropsFil(propsFil):
properties={}
propFil = Properties()
propFil.load(FileInputStream(propsFil))
@bmoussaud
bmoussaud / inject.py
Created November 10, 2015 10:09
Custom Personal Crendential plugins
def mappings():
mapping = {}
mapping['tomcat.VirtualHost']=(lambda c: c.server.host)
mapping['was.Cluster']=(lambda c: c.getHost())
mapping['wls.Cluster']=(lambda c: c.getHost())
mapping['wls.JmsServer']=(lambda c: c.getHost())
mapping['cyber-ark.SshHost']=(lambda c: c)
mapping['overthere.SshHost']=(lambda c: c)
mapping['overthere.LocalHost']=(lambda c: c)
@bmoussaud
bmoussaud / planning-check.py
Created November 24, 2015 09:13
XLDeploy: Check running tasks running or have scheduled to prevent several deployment on the same environment
def deployedApplication():
return specification.deployedOrPreviousApplication
environment = deployedApplication().environment
candidates = filter(lambda task: task.metadata['environment_id'] == environment.id, taskService.allCurrentTasks)
if len(candidates) == 1:
raise Exception("%d deployment task is running or has been scheduled on '%s'" % (len(candidates), environment.id))
@bmoussaud
bmoussaud / Precondition1.py
Last active November 24, 2015 14:52
XLR preconditions
print getCurrentTask().title
print getCurrentTask().pythonScript.deploymentPackage
result = "hotfix" not in getCurrentTask().pythonScript.deploymentPackage
@bmoussaud
bmoussaud / check-application-requirements.py
Created November 26, 2015 08:33
check required deployed application
def deployedApplication():
return specification.deployedOrPreviousApplication
version = deployedApplication().version
environment_id = deployedApplication().environment.id
applicationRequirements = version.applicationRequirements
print "Checking Application Requirements: %s " % applicationRequirements
missingRequirements = []
for application in applicationRequirements.keys():
@bmoussaud
bmoussaud / comment.py
Last active December 3, 2015 13:55
Comment / uncomment java property file entry
from com.xebialabs.overthere.util import OverthereUtils
from java.io import PrintWriter
def comment(line):
if line.startswith(entry):
return "#"+line
else:
return line
def out_line(pw,line,lineSeparator):
@bmoussaud
bmoussaud / readme.md
Last active December 13, 2015 18:58
Deployit: wrapper.conf for deployit 3.8.x
  • Unzip yajsw-stable-11.04.zip to c:/yajsw-stable-11.04
  • copy wrapper.conf to c:\yajsw-stable-11.04\conf
  • cd C:\yajsw-stable-11.04\bat
  • runConsole.bat
  • If all is ok (no error in the output), please execute a test with your browser http://localhost:4516 (username admin, password admin)
  • if you've some troubles, please add wrapper.debug=true in your wrapper file.
  • If you can connect , please kill the runConsole.bat
  • to install the service , please run installService.bat
  • to uninstall the service , please run uninstallService.bat