def cleanup(self): script = "grep -i '^DROP TABLE' '%s' | mysql --host='%s' --user='******' --password='******' %s" % (self.fullpath(), self.hostname, self.username, self.password, self.dbname) ShellScriptHelper.run(script)
def build(self): mysql = "mysql -h %s -u%s" % (self.credentials.hostname, self.credentials.username) if self.credentials.password != None and len( self.credentials.password.strip()) > 0: mysql = mysql + " -p" + self.credentials.password # create data base create_db_cmd = "echo 'CREATE DATABASE IF NOT EXISTS %s;' | %s" % ( self.dbname, mysql) try: ShellScriptHelper.run(create_db_cmd) except: return False #raise BaseException("Cannot create '%s' data base." % self.dbname) # grant permission create_db_cmd = "GRANT ALL ON %s.* TO '%s'@'%s'" % ( self.dbname, self.username, self.hostname) if self.password != None and len(self.password.strip()) > 0: create_db_cmd = create_db_cmd + (" IDENTIFIED BY '%s'" % self.password) create_db_cmd = "echo \"%s;\" | %s" % (create_db_cmd, mysql) try: ShellScriptHelper.run(create_db_cmd) except: return False #raise BaseException("Cannot grant permission to '%s' data base." % self.dbname) return True
def build(self): path = self.fullpath() if not os.path.exists(path): raise IOError("Script '%s' doesn't exist." % (path)) script = "mysql --host='%s' --user='******' --password='******' %s < %s" % ( self.hostname, self.username, self.password, self.dbname, self.fullpath()) ShellScriptHelper.run(script)
def build(self): path = self.fullpath() if not os.path.exists(path): raise IOError("Script '%s' doesn't exist." % (path)) script = "mysql --host='%s' --user='******' --password='******' %s < %s" % (self.hostname, self.username, self.password, self.dbname, self.fullpath()) ShellScriptHelper.run(script)
def build(self): self.destination.build() zippath = self.fullpath() destination = self.destination.fullpath() tmp = tempfile.mkstemp(dir=Artifact.home_dir()) null = open(tmp[1], "w") try: ShellScriptHelper.run('unzip', " %s -d %s " % (zippath, destination), False, null) finally: null.close() os.remove(tmp[1])
def build(self): mysql = "mysql -h %s -u%s" % (self.credentials.hostname, self.credentials.username) if self.credentials.password != None and len(self.credentials.password.strip()) > 0: mysql = mysql + " -p" + self.credentials.password # create data base create_db_cmd = "echo 'CREATE DATABASE IF NOT EXISTS %s;' | %s" % (self.dbname, mysql) try: ShellScriptHelper.run(create_db_cmd) except: return False #raise BaseException("Cannot create '%s' data base." % self.dbname) # grant permission create_db_cmd = "GRANT ALL ON %s.* TO '%s'@'%s'" % (self.dbname, self.username, self.hostname) if self.password != None and len(self.password.strip()) > 0: create_db_cmd = create_db_cmd + (" IDENTIFIED BY '%s'" % self.password) create_db_cmd = "echo \"%s;\" | %s" % (create_db_cmd, mysql) try: ShellScriptHelper.run(create_db_cmd) except: return False #raise BaseException("Cannot grant permission to '%s' data base." % self.dbname) return True
def build(self): os.chdir(os.path.dirname(self.fullpath())) ShellScriptHelper.run("make", self.parameters, False)
def build(self): ShellScriptHelper.run(self.fullpath(), self.parameters, True)
def cleanup(self): script = "grep -i '^DROP TABLE' '%s' | mysql --host='%s' --user='******' --password='******' %s" % ( self.fullpath(), self.hostname, self.username, self.password, self.dbname) ShellScriptHelper.run(script)