示例#1
0
def test():
  from fabric.contrib.files import exists as fe
  from fabric.contrib.files import cd

  from fabric.api import env as e
  from install.utils import _cd, _fe, _s
  
  conf = {}
  conf['INSTALL_DIR'] =  '/srv/lmt'
  conf['WORKER_DIR'] = '/worker'
  
  with _cd(conf['INSTALL_DIR']):
    print conf['INSTALL_DIR']
    print conf['WORKER_DIR']+"/run_glass"
    print _fe(conf['INSTALL_DIR']+conf['WORKER_DIR']+"/run_glass")
示例#2
0
def postInstallCmds():
  with _cd(conf['INSTALL_DIR']):
    if not _fe(conf['INSTALL_DIR']+conf['WORKER_DIR']+"/run_glass"):
      _w("svn checkout https://svn.physik.uzh.ch/repos/itp/glass ."+conf['WORKER_DIR'])
      _w("echo backend : Agg > matplotlibrc")
      _w("echo 'backend : Agg' > %(INSTALL_DIR)s%(WORKER_DIR)s/matplotlibrc" % conf)
    with _v('.'+conf['WORKER_DIR']):
      _s("make")
      _s("python setup.py build")
    with _cd('.'+conf['WORKER_DIR']):
      _s("chown -R %(SYS_USER)s:%(SYS_GROUP)s %(INSTALL_DIR)s" % conf)
      _s("chmod -R u+rwx %(INSTALL_DIR)s" % conf)
示例#3
0
def testInstall():
  # enable the default site and check if it answers
  _s("ln -s -f /etc/nginx/sites-available/default /etc/nginx/sites-enabled")
  _s("/etc/init.d/nginx restart")
  _r("wget %(PUBLIC_URL)s:%(PUBLIC_PORT)s" % conf)
  test = _fe("index.html")
  with settings(warn_only=True):
    resp = _r("grep 'Welcome to nginx' index.html")
    test = test and resp.return_code
  if not test: warn(yellow('nginx is not running properly'))
  _r("rm index.html")
  _s("rm /etc/nginx/sites-enabled/default")
  _s("/etc/init.d/nginx restart")