<commit_before>import re
import subprocess

from nexentaedge.settings import Settings
from nexentaedge.nedgeBlockerException import NedgeBlockerException
from baseConfigurationStep import BaseConfigurationStep

blocker_patterns = ['^.*(Less\s+then\s+\d+.*disks)$',
                    '^.*(Interface.*missing).*$',
                    '^.*(Network interface too slow)$',
                    '^.*(Not enough RAM memory.*GB).*$'
                    ]


class NedeployPrecheck(BaseConfigurationStep):
    def __init__(self):
        pass

    def process(self, environment):

        neadmCmd = self.create_precheck_cmd(environment)

        print("NEDEPLOY cmd is: {0}".format(' '.join(neadmCmd)))

        try:
            subprocess.check_output(neadmCmd,
                                    stderr=subprocess.STDOUT,
                                    universal_newlines=True)

        except subprocess.CalledProcessError as ex:
            print(" OUTPUT:\n{}".format(ex.output))
            blockers = self.get_blockers(ex.output)
            raise NedgeBlockerException(blockers)

    def get_blockers(self, error_output):

        results = []
        for pattern in blocker_patterns:
            m = re.search(pattern, error_output, re.MULTILINE)
            if m:
                results.append(m.group(1))
                print('MATCHED {}'.format(m.group(1)))
        return results

    def create_precheck_cmd(self, environment):


        activation_key = environment['activation_key']
        node_private_ip = environment['node_private_ip']
        node_type = environment['node_type']
        replicast_eth = environment['replicast_eth']
        nodocker = environment['nodocker']
        profile = environment['profile']
        exclude = environment['exclude']
        reserved = environment['reserved']

        print("\tnode_private_ip : {}".format(node_private_ip))
        print("\tnode_type      : {}".format(node_type))
        print("\treplicast_eth  : {}".format(replicast_eth))
        print("\tnodocker       : {}".format(nodocker))
        print("\tprofile        : {}".format(profile))
        print("\texclude        : {}".format(exclude))<commit_msg>TA18271 fix typo<commit_after>import re
import subprocess

from nexentaedge.settings import Settings
from nexentaedge.nedgeBlockerException import NedgeBlockerException
from baseConfigurationStep import BaseConfigurationStep

blocker_patterns = ['^.*(Less\s+then\s+\d+.*disks)$',
                    '^.*(Interface.*missing).*$',
                    '^.*(Network interface too slow)$',
                    '^.*(Not enough RAM memory.*GB).*$'
                    ]


class NedeployPrecheck(BaseConfigurationStep):
    def __init__(self):
        pass

    def process(self, environment):

        neadmCmd = self.create_precheck_cmd(environment)

        print("NEDEPLOY cmd is: {0}".format(' '.join(neadmCmd)))

        try:
            subprocess.check_output(neadmCmd,
                                    stderr=subprocess.STDOUT,
                                    universal_newlines=True)

        except subprocess.CalledProcessError as ex:
            print(" OUTPUT:\n{}".format(ex.output))
            blockers = self.get_blockers(ex.output)
            raise NedgeBlockerException(blockers)

    def get_blockers(self, error_output):

        results = []
        for pattern in blocker_patterns:
            m = re.search(pattern, error_output, re.MULTILINE)
            if m:
                results.append(m.group(1))
                print('MATCHED {}'.format(m.group(1)))
        return results

    def create_precheck_cmd(self, environment):


        activation_key = environment['nedge_activation_key']
        node_private_ip = environment['node_private_ip']
        node_type = environment['node_type']
        replicast_eth = environment['replicast_eth']
        nodocker = environment['nodocker']
        profile = environment['profile']
        exclude = environment['exclude']
        reserved = environment['reserved']

        print("\tnode_private_ip : {}".format(node_private_ip))
        print("\tnode_type      : {}".format(node_type))
        print("\treplicast_eth  : {}".format(replicast_eth))
        print("\tnodocker       : {}".format(nodocker))
        print("\tprofile        : {}".format(profile))
        print("\texclude        : {}".format(exclude))
{'fraction_non_alphanumeric': 0.11977142857142857, 'fraction_numerical': 0.002514285714285714, 'mean_word_length': 2.3176648976497347, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4025537', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1170, 'n_words': 213}