Exemplo n.º 1
0
def add_repo_changes(repo_name):
    try:
        repo_path = os.getcwd() + "/vlead-repos/" + repo_name
        cmd = "git -C %s add license.org" % (repo_path)
        execute_command(cmd)
    except Exception as e:
        print str(e)
Exemplo n.º 2
0
def commit_changes(repo_name):
    commit_msg = "'added licensing file'"
    repo_path = os.getcwd() + "/vlead-repos/" + repo_name
    cmd = "git -C %s commit -m %s" % (repo_path, commit_msg)
    print cmd
    try:
        execute_command(cmd)
    except Exception as e:
        return
Exemplo n.º 3
0
def push_changes(repo_name):
    print "******push***********"
    repo_path = os.getcwd() + "/" + repo_name
    cmd = "git -C %s push origin master" % (repo_path)
    print cmd
    try:
        git_creden()
        execute_command(cmd)

    except Exception as e:
        return
Exemplo n.º 4
0
 def pull_repo(self, repo_name, version):
     repo = self.git_clone_loc + repo_name
     pull_cmd = "git -C %s pull origin %s" % (repo, version)
     try:
         (ret_code, output) = execute_command(pull_cmd)
     except Exception, e:
         raise e
Exemplo n.º 5
0
 def reset_repo(self, repo_name):
     repo = self.git_clone_loc + repo_name
     reset_cmd = "git --git-dir=%s/.git --work-tree=%s reset --hard" % (
         repo, repo)
     try:
         (ret_code, output) = execute_command(reset_cmd)
     except Exception, e:
         raise e
Exemplo n.º 6
0
 def clone_repo(self, lab_src_url, repo_name):
     print lab_src_url
     clone_cmd = "git clone %s %s%s" % (lab_src_url, self.git_clone_loc,
                                        repo_name)
     try:
         (ret_code, output) = execute_command(clone_cmd)
     except Exception, e:
         raise e
Exemplo n.º 7
0
 def checkout_version(self, repo_name, version=None):
     repo = self.git_clone_loc + repo_name
     if version is None:
         version = "master"
     checkout_cmd = "git --git-dir=%s/.git --work-tree=%s checkout %s" % (
         repo, repo, version)
     try:
         (ret_code, output) = execute_command(checkout_cmd)
     except Exception, e:
         raise e
Exemplo n.º 8
0
def remove_files(file_path):
    try:
        cmd = "rm -rf %s" % (file_path)
        (ret_code, output) = execute_command(cmd)
        if ret_code == 0:
            print ""
        else:
            print "Error in while %s" % (cmd)
    except Exception as e:
        print str(e)
Exemplo n.º 9
0
def rsync_files(src_file, dest_file):
    try:
        copy_command = "rsync -arz --progress " + src_file + " " + dest_file
        command = ('%s' % (copy_command))
        (ret_code, output) = execute_command(command)
        if ret_code == 0:
            print ""
        else:
            print "Error in while command %s" % (copy_command)
    except Exception as e:
        print str(e)
Exemplo n.º 10
0
    def convert_table_to_xml(self, tbl_name):

        try:
            if not os.makedirs(self.path):
                os.path.isdir(self.path)
        except Exception as e:
            pass

        cmd = "mysqldump --xml --no-data -h %s -u %s -p%s %s %s > %s/%s.xml" % \
              (self.host, self.user, self.pswd, self.name, tbl_name, self.path, tbl_name)
        try:
            (ret_code, output) = execute_command(cmd)
            if ret_code != 0:
                print "Error in executing command %s" % (cmd)
        except Exception as e:
            raise e
Exemplo n.º 11
0
def rsync_files(src_path, dest_path):
    print "******copying license file********"
    cmd = "rsync -avz %s %s" % (src_path, dest_path)
    (ret_code, output) = execute_command(cmd)
    return ret_code
Exemplo n.º 12
0
def rename_file(src_name, dest_name):
    cmd = "mv %s %s" % (src_name, dest_name)
    (ret_code, output) = execute_command(cmd)
    print "rename is done"
    return ret_code