def print_repos(prefix): paths = os.listdir(os.path.join(config.REPO_ROOT, prefix)) print "\n[ Repositories in %s ]" % os.path.join(config.REPO_ROOT, prefix) paths.sort() for path in paths: if Repository.exists(os.path.join(config.REPO_ROOT, prefix, path)): print path
def _run_commit(self, options, args): """Commit the repository yaml descriptor file.""" prefix, name = __parse_prefix_name(args[0]) try: repo = __load_repository_from_yaml(prefix, name) except CommandError: repo = Repository(prefix, name) if not Repository.exists(repo.path_to_repo): raise CommandError('Cannot commit a descriptor for a repo that doesn\'t exist.') if(options.add): __add_yaml(repo) __checkin_yaml(repo, "Committing yaml descriptor for %s." % repo.path)
def _run_create(self, options, args): """ Create the repository. Save the yaml descriptor. """ prefix, name = __parse_prefix_name(args[0]) print "Name = %s" % name if prefix: print "Prefix = %s" % prefix print "Fisheye = %s" % options.fisheye repo = Repository(prefix, name, options.fisheye) if Repository.exists(repo.path_to_repo): raise CommandError('A repository named "%s" already exists.' % repo.path) try: __check_path_dir(repo) print 'Creating the repository ...' repo.create() print 'Created the repository' print repo.apache_conf apache_conf.process_to_file(repo.apache_conf, {'repopath' : repo.path, 'users' : ', '.join(repo.users()), 'apache_authz_path' : repo.apache_authz}) print "Created apache conf" __write_repository_yaml(repo) print "CREATED repository at %s." % repo.path if options.fisheye: __write_repository_fisheyeauth(repo) fisheye_admin = FisheyeAdmin(password=config.FISHEYE_ADMIN_PW) if fisheye_admin.create_repository(repo, __get_description()): print "Successfully created a fisheye instance for %s" % repo.name except Exception, e: raise CommandError("Failed to create the repository at %s\n" % repo.path_to_repo, "The original error was: %s: %s" % (type(e), e))