def check_repository(cls, path, username=None, password=None, local_site_name=None): """ Performs checks on a repository to test its validity. This should check if a repository exists and can be connected to. This will also check if the repository requires an HTTPS certificate. The result is returned as an exception. The exception may contain extra information, such as a human-readable description of the problem. If the repository is valid and can be connected to, no exception will be thrown. """ super(BZRTool, cls).check_repository(path, username, password, local_site_name) if local_site_name and sshutils.is_ssh_uri(path): path += '?rb-local-site-name=%s' % local_site_name try: tree, branch, repository, relpath = \ bzrdir.BzrDir.open_containing_tree_branch_or_repository(path) except AttributeError: raise RepositoryNotFoundError() except NotBranchError, e: raise RepositoryNotFoundError()
def check_repository(cls, path, username=None, password=None): """ Performs checks on a repository to test its validity. This should check if a repository exists and can be connected to. This will also check if the repository requires an HTTPS certificate. The result is returned as an exception. The exception may contain extra information, such as a human-readable description of the problem. If the repository is valid and can be connected to, no exception will be thrown. """ if sshutils.is_ssh_uri(path): sshutils.check_host(urlparse.urlparse(path)[1], # netloc username, password)
def check_repository(cls, path, username=None, password=None): """ Performs checks on a repository to test its validity. This should check if a repository exists and can be connected to. This will also check if the repository requires an HTTPS certificate. The result is returned as an exception. The exception may contain extra information, such as a human-readable description of the problem. If the repository is valid and can be connected to, no exception will be thrown. """ if sshutils.is_ssh_uri(path): username, hostname = SCMTool.get_auth_from_uri(path, username) logging.debug( "%s: Attempting ssh connection with host: %s, username: %s" % \ (cls.__name__, hostname, username)) sshutils.check_host(hostname, username, password)
def _get_full_path(self, path, basedir=None): """Returns the full path to a file.""" parts = [self.repository.path.rstrip("/")] if basedir: parts.append(basedir.strip("/")) parts.append(path.strip("/")) final_path = "/".join(parts) if final_path.startswith("/"): final_path = "file://%s" % final_path if self.repository.local_site and sshutils.is_ssh_uri(final_path): final_path += '?rb-local-site-name=%s' % \ self.repository.local_site.name return final_path