# Path: toolbox/config/common.py
# BUTTON_CONFIG_KEYS = {'text', 'hidden'}
# 
# CRP_TYPES = {'docker', 'gce', 'static'}
# 
# CURRENT_MAX_VERSION = 'v3.2'
# 
# CURRENT_MIN_VERSION = 'v3.1'
# 
# PROTOCOLS = {'udp', 'tcp', 'ssh', 'http', 'ws', CONTROLLER_PROTOCOL}
# 
# Path: toolbox/utils/utils.py
# def counted_error(*args, **kwargs) -> None:
#     """
#     Wrapper for logging.error that will increase the error_counter
#     """
#     global _error_counter  # pylint: disable=global-statement
#     _error_counter += 1
#     logging.error(*args, **kwargs)
# 
# def fatal_error(*args, **kwargs) -> None:
#     """
#     Abort execution with a fatal error
#     """
#     counted_error(*args, **kwargs)
#     counted_error_at_exit()


import os
import re
import yaml
    from packaging.version import parse as parse_version
    from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, PROTOCOLS
from .utils import counted_error, fatal_error
            try:
                if not 0 < int(port) < 65536:
                    raise ValueError
            except Exception:
                counted_error('Invalid port number: %s. Ports must be numbers between 1 and 65535.', port)

            if protocol not in PROTOCOLS:
                counted_error('Invalid protocol in config.yml: %s. Valid protocols: %s', protocol, PROTOCOLS)

            if protocol == 'ssh':
                ssh_ports_count += 1

        except Exception:
            counted_error('Invalid port format. [port/protocol]')

    if len(unique_ports) != len(ports):
        counted_error('Duplicate port numbers found.')

    if ssh_ports_count > 1:
        counted_error('More than one SSH ports. Please, use a single SSH connection.')

    if buttons is not None:
        if not isinstance(buttons, dict):
            counted_error('The buttons field must be a dict.')
        else:
            for button_key, button in buttons.items():
                if button_key not in ports:
                    counted_error('Button key %s is not found in ports.', button_key)

                for key in button.keys():

# Path: toolbox/config/common.py
# BUTTON_CONFIG_KEYS = {'text', 'hidden'}
# 
# CRP_TYPES = {'docker', 'gce', 'static'}
# 
# CURRENT_MAX_VERSION = 'v3.2'
# 
# CURRENT_MIN_VERSION = 'v3.1'
# 
# PROTOCOLS = {'udp', 'tcp', 'ssh', 'http', 'ws', CONTROLLER_PROTOCOL}
# 
# Path: toolbox/utils/utils.py
# def counted_error(*args, **kwargs) -> None:
#     """
#     Wrapper for logging.error that will increase the error_counter
#     """
#     global _error_counter  # pylint: disable=global-statement
#     _error_counter += 1
#     logging.error(*args, **kwargs)
# 
# def fatal_error(*args, **kwargs) -> None:
#     """
#     Abort execution with a fatal error
#     """
#     counted_error(*args, **kwargs)
#     counted_error_at_exit()


# Path: toolbox/utils/config.py
import os
import re
import yaml
    from packaging.version import parse as parse_version
    from pkg_resources import parse_version
from toolbox.config.common import BUTTON_CONFIG_KEYS, CRP_TYPES, CURRENT_MAX_VERSION, CURRENT_MIN_VERSION, PROTOCOLS
from .utils import counted_error, fatal_error

            try:
                if not 0 < int(port) < 65536:
                    raise ValueError
            except Exception:
                counted_error('Invalid port number: %s. Ports must be numbers between 1 and 65535.', port)

            if protocol not in PROTOCOLS:
                counted_error('Invalid protocol in config.yml: %s. Valid protocols: %s', protocol, PROTOCOLS)

            if protocol == 'ssh':
                ssh_ports_count += 1

        except Exception:
            counted_error('Invalid port format. [port/protocol]')

    if len(unique_ports) != len(ports):
        counted_error('Duplicate port numbers found.')

    if ssh_ports_count > 1:
        counted_error('More than one SSH ports. Please, use a single SSH connection.')

    if buttons is not None:
        if not isinstance(buttons, dict):
            counted_error('The buttons field must be a dict.')
        else:
            for button_key, button in buttons.items():
                if button_key not in ports:
                    counted_error('Button key %s is not found in ports.', button_key)

                for key in button.keys():

                    if key not in BUTTON_CONFIG_KEYS: