<commit_before>import io
import logging
import time
from urllib.parse import parse_qs, urlparse

import requests
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.utils.functional import cached_property

from waldur_core.core import models as core_models
from waldur_core.core import utils as core_utils
from waldur_core.media.utils import guess_image_extension
from waldur_core.structure import ServiceBackend
from waldur_core.structure.models import ServiceSettings
from waldur_core.structure.utils import update_pulled_fields
from waldur_mastermind.common.utils import parse_datetime
from waldur_rancher.enums import ClusterRoles, GlobalRoles
from waldur_rancher.exceptions import NotFound, RancherException

from . import client, models, signals, utils

logger = logging.getLogger(__name__)


class RancherBackend(ServiceBackend):

    DEFAULTS = {
        'cloud_init_template': '#cloud-config\n'
        'packages: \n'
        '  - curl\n'
        'runcmd:\n'
        '  - curl -fsSL https://get.docker.com -o get-docker.sh; sh get-docker.sh\n'
        '  - sudo systemctl start docker\n'
        '  - sudo systemctl enable docker\n'
        '  - [ sh, -c, "{command}" ]\n',
        'default_mtu': 1440,
        'private_registry_url': None,
        'private_registry_user': None,
        'private_registry_password': None,
    }

    def __init__(self, settings):
        """<commit_msg>Lower default MTU value as mostly OpenStack with VxLAN is used for deployments<commit_after>import io
import logging
import time
from urllib.parse import parse_qs, urlparse

import requests
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.utils.functional import cached_property

from waldur_core.core import models as core_models
from waldur_core.core import utils as core_utils
from waldur_core.media.utils import guess_image_extension
from waldur_core.structure import ServiceBackend
from waldur_core.structure.models import ServiceSettings
from waldur_core.structure.utils import update_pulled_fields
from waldur_mastermind.common.utils import parse_datetime
from waldur_rancher.enums import ClusterRoles, GlobalRoles
from waldur_rancher.exceptions import NotFound, RancherException

from . import client, models, signals, utils

logger = logging.getLogger(__name__)


class RancherBackend(ServiceBackend):

    DEFAULTS = {
        'cloud_init_template': '#cloud-config\n'
        'packages: \n'
        '  - curl\n'
        'runcmd:\n'
        '  - curl -fsSL https://get.docker.com -o get-docker.sh; sh get-docker.sh\n'
        '  - sudo systemctl start docker\n'
        '  - sudo systemctl enable docker\n'
        '  - [ sh, -c, "{command}" ]\n',
        'default_mtu': 1400,
        'private_registry_url': None,
        'private_registry_user': None,
        'private_registry_password': None,
    }

    def __init__(self, settings):
        """
{'fraction_non_alphanumeric': 0.08251606357795063, 'fraction_numerical': 0.002705444707473791, 'mean_word_length': 3.7177033492822966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5499832', 'n_tokens_mistral': 914, 'n_tokens_neox': 897, 'n_words': 240}