Skip to content

Instantly share code, notes, and snippets.

@paulosuzart
Created August 4, 2010 16:21
Show Gist options
  • Save paulosuzart/508384 to your computer and use it in GitHub Desktop.
Save paulosuzart/508384 to your computer and use it in GitHub Desktop.
from fabric.operations import sudo, local, put, run
from fabric.api import *
from fabric.context_managers import cd
import logging
env.cwd = '/home/user'
env.hosts = ['linx']
env.user = 'user'
env.password = 'user'
conf = {'tempdir' : '/tmp/',
'extdir' : '/oracle/ext_11.1.1/',
'separator' : '/'}
#do I need to use the separator? Lets use linux!!
def addjar(jar):
"""Adds the jar located in the absolute path (in jar argument) to the
SOA-INFRA app"""
def _clear_addjar(name):
with cd (conf['tempdir']):
run('rm %s' %name)
name = jar[jar.rfind(conf['separator']) + 1:] #extracts the name only
put(jar, conf['tempdir']) #uploads the file to a tmp dir
with cd (conf['extdir']):
run('cp %s%s .' % (conf['tempdir'], name, )) #cp from tmp
run('ant') #builds the extension
_clear_addjar(name) #clear any track
#run it via fab addjar:jar=./myjar.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment