Example #1
0
def beforeInstallCmds():
  # add rabbitmq to sources
  v = {'file': "/etc/apt/sources.list",
       'txt': "deb http://www.rabbitmq.com/debian/ testing main"}
  _s("grep -q '%(txt)s' %(file)s || echo '%(txt)s' >> %(file)s" % v)
  _r("wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc")
  _s("apt-key add rabbitmq-signing-key-public.asc")
  _r("rm rabbitmq-signing-key-public.asc")
Example #2
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")
Example #3
0
def _mysql_is_installed():
  with fabric.api.settings(fabric.api.hide('stderr'), warn_only=True):
    output = _r('mysql --version')
  try:
    return output.succeeded
  except AttributeError:
    return False
Example #4
0
def mysql_execute(sql, user='', password=''):
  """
  Executes passed sql command using mysql shell.
  """
  with fabric.api.settings(warn_only=True):
    return _r("echo '%s' | mysql -u%s -p%s" % (sql, user, password))