from parallels.core.utils.migrator_utils import get_optional_option_value
from parallels.plesk.source.plesk.actions.utils import get_target_plesk_server


def is_copy_external_id_disabled(global_context):
    cli_skip_copy_external_id = get_optional_option_value(
        global_context.options, 'skip_copy_external_id', False
    )

    target_plesk_server = get_target_plesk_server(global_context)
    config_skip_external_id = target_plesk_server.config.is_skip_external_id

    return cli_skip_copy_external_id or config_skip_external_id
