示例#1
0
 def createDB(self):
   (su_status, su_stdout, su_stderr) = installHelper.subprocess_cmd("sudo -u postgres createdb wowdb -O pguser")
   
   if su_status == 0:
     print "Could not create database"    
     return su_stderr
   else:
     print "wow database created" 
     return su_status
示例#2
0
 def installDependencies(self):
   cmd = "apt-get -y install curl git nodejs nodejs-legacy redis-server postgresql mongodb postgresql-client postgresql-contrib rsync python-psycopg2"
   (install_status, install_stdout, install_stderr) = installHelper.subprocess_cmd(cmd)
   
   if install_status == 0:
     print "Successfully installed dependencies", install_stdout
     log.info("Successfully installed dependencies", install_stdout)
     return install_status
   else:
     print "Failed to install dependencies run this script as sudo"
     log.error("Failed to install dependencies", install_status, install_stdout, install_stderr)
     return None
示例#3
0
 def updateAptitude(self):
   cmd = "apt-get update -y"
   (update_status,update_stdout, update_stderr) = installHelper.subprocess_cmd(cmd)
   
   if update_status == 0:
     print "Successfully updated aptitude", update_stdout
     log.info("Successfully updated aptitude", update_stdout)
     return update_status
   else:
     print "Failed to update aptitude run this script as sudo"
     log.error("Failed to update aptitude.", update_status, update_stdout, update_stderr)
     return None
示例#4
0
 def installNPMDependencies(self):
   cmd = "sudo npm install -g grunt-cli karma bower pm2"
   (npm_status, npm_stdout, npm_stderr) = installHelper.subprocess_cmd(cmd)
   
   if npm_status == 0:
     print "Successfully installed npms Dependencies", npm_stdout
     log.info("Successfully installed npms Dependencies", npm_stdout)
     return npm_status
   else:
     print "Failed to install npm's Dependencies run this script as sudo"
     log.error("Failed to install NPM's Dependencies", npm_status, npm_stdout, npm_stderr)
     return None
示例#5
0
 def installNPM(self):
   cmd = "sudo apt-get install npm"
   (npm_status, npm_stdout, npm_stderr) = installHelper.subprocess_cmd(cmd)
   
   if npm_status == 0:
     print "Successfully installed npm", npm_stdout
     log.info("Successfully installed npm", npm_stdout)
     return npm_status
   else:
     print "Failed to install npm run this script as sudo"
     log.error("Failed to install npm", npm_status, npm_stdout, npm_stderr)
     return None
示例#6
0
  def createPostgresUser(self):
    cmd = 'sudo -u postgres psql -c "create user pguser with password {}"'.format('pgwow')
    if installHelper.is_nix_user(self.user):
      print self.user, " already exists"
      return 0

    (user_status, user_stdout,user_stderr) = installHelper.subprocess_cmd(cmd)

    if user_status == 0:
      print "Create nix user successful", user_stdout
      log.info("Create nix user successful",user_stdout)
      return user_status
    else:
      print "Failed to create nix user please run this script as sudo"
      log.error("Failed to create nix user.", user_status, user_stdout, user_stderr)
      return None
示例#7
0
  def createLinuxUser(self):
    cmd = "useradd {} -G www-data -m -p pgwow".format(self.user)
    if installHelper.is_nix_user(self.user):
      print self.user, " already exists"
      return 0

    (user_status, user_stdout,user_stderr) = installHelper.subprocess_cmd(cmd)

    if user_status == 0:
      print "Create nix user successful", user_stdout
      log.info("Create nix user successful",user_stdout)
      return user_status
    else:
      print "Failed to create nix user please run this script as sudo"
      log.error("Failed to create nix user.", user_status, user_stdout, user_stderr)
      return None