forked from p15670423/monkey
cc: address flake8 issues
This commit is contained in:
parent
a057dec1fe
commit
dd9e4bdefa
|
@ -2,8 +2,8 @@ from gevent import monkey as gevent_monkey
|
||||||
|
|
||||||
gevent_monkey.patch_all()
|
gevent_monkey.patch_all()
|
||||||
|
|
||||||
from monkey_island.cc.main import main
|
from monkey_island.cc.main import main # noqa: E402
|
||||||
from monkey_island.cc.environment.environment_config import DEFAULT_SERVER_CONFIG_PATH
|
from monkey_island.cc.environment.environment_config import DEFAULT_SERVER_CONFIG_PATH # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def parse_cli_args():
|
def parse_cli_args():
|
||||||
|
|
|
@ -37,6 +37,7 @@ def set_to_standard():
|
||||||
env.save_config()
|
env.save_config()
|
||||||
user_store.UserStore.set_users(env.get_auth_users())
|
user_store.UserStore.set_users(env.get_auth_users())
|
||||||
|
|
||||||
|
|
||||||
def initialize_from_file(file_path):
|
def initialize_from_file(file_path):
|
||||||
try:
|
try:
|
||||||
config = EnvironmentConfig(file_path)
|
config = EnvironmentConfig(file_path)
|
||||||
|
@ -49,4 +50,5 @@ def initialize_from_file(file_path):
|
||||||
logger.error('Failed initializing environment', exc_info=True)
|
logger.error('Failed initializing environment', exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
initialize_from_file(DEFAULT_SERVER_CONFIG_PATH)
|
initialize_from_file(DEFAULT_SERVER_CONFIG_PATH)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
@ -6,10 +5,12 @@ from unittest import TestCase
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
|
from monkey_island.cc.server_utils.consts import MONKEY_ISLAND_ABS_PATH
|
||||||
from common.utils.exceptions import (AlreadyRegisteredError, CredentialsNotRequiredError,
|
from common.utils.exceptions import (AlreadyRegisteredError,
|
||||||
InvalidRegistrationCredentialsError, RegistrationNotNeededError)
|
CredentialsNotRequiredError,
|
||||||
from monkey_island.cc.environment import Environment, EnvironmentConfig, UserCreds
|
InvalidRegistrationCredentialsError,
|
||||||
|
RegistrationNotNeededError)
|
||||||
|
from monkey_island.cc.environment import (Environment, EnvironmentConfig,
|
||||||
|
UserCreds)
|
||||||
|
|
||||||
TEST_RESOURCES_DIR = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing", "environment")
|
TEST_RESOURCES_DIR = os.path.join(MONKEY_ISLAND_ABS_PATH, "cc", "testing", "environment")
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ PARTIAL_CREDENTIALS = os.path.join(TEST_RESOURCES_DIR, "server_config_partial_cr
|
||||||
STANDARD_WITH_CREDENTIALS = os.path.join(TEST_RESOURCES_DIR,
|
STANDARD_WITH_CREDENTIALS = os.path.join(TEST_RESOURCES_DIR,
|
||||||
"server_config_standard_with_credentials.json")
|
"server_config_standard_with_credentials.json")
|
||||||
STANDARD_ENV = os.path.join(TEST_RESOURCES_DIR,
|
STANDARD_ENV = os.path.join(TEST_RESOURCES_DIR,
|
||||||
"server_config_standard_env.json")
|
"server_config_standard_env.json")
|
||||||
|
|
||||||
|
|
||||||
def get_tmp_file():
|
def get_tmp_file():
|
||||||
|
|
|
@ -21,7 +21,7 @@ json_setup_logging(default_path=Path(MONKEY_ISLAND_ABS_PATH, 'cc', 'island_logge
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
|
import monkey_island.cc.environment.environment_singleton as env_singleton # noqa: E402
|
||||||
from monkey_island.cc.server_utils.consts import DEFAULT_SERVER_CONFIG_PATH
|
from monkey_island.cc.server_utils.consts import DEFAULT_SERVER_CONFIG_PATH # noqa: E402
|
||||||
from common.version import get_version # noqa: E402
|
from common.version import get_version # noqa: E402
|
||||||
from monkey_island.cc.app import init_app # noqa: E402
|
from monkey_island.cc.app import init_app # noqa: E402
|
||||||
from monkey_island.cc.server_utils.bootloader_server import BootloaderHttpServer # noqa: E402
|
from monkey_island.cc.server_utils.bootloader_server import BootloaderHttpServer # noqa: E402
|
||||||
|
|
Loading…
Reference in New Issue