def METHOD_NAME(self):
    """Validate content name if one found from directory path.
    A repository role exists at root, so content name will not exist yet.
    """
    if not self.name:
        return
    if not re.match(constants.CONTENT_NAME_REGEXP, self.name):
        raise exc.ContentNameError(
            f"{self.content_type} has invalid name: '{self.name}', "
            "expecting name to contain only lowercase "
            "alphanumeric characters or '_'"
        )