def check_write(repo): try: repo_testfile = '.repo_test_file' repo_run_command(repo, 'touch %s' % repo_testfile).stdout.strip() repo_run_command(repo, 'rm ' + repo_testfile) except error.CmdError: raise error.RepoWriteError('Unable to write to ' + repo)
def check_write(repo): ''' Checks that the remote repository directory is writable :type repo: string :param repo: a remote package repo URL :raise error.RepoWriteError: repository write error ''' try: repo_testfile = '.repo_test_file' repo_run_command(repo, 'touch %s' % repo_testfile).stdout.strip() repo_run_command(repo, 'rm ' + repo_testfile) except error.CmdError: raise error.RepoWriteError('Unable to write to ' + repo)