"""
    This script is executed by the `software-packages` command.

    vcenter product produces one patch payload with semantically different two
    kind of patch scripts logic - day0 patching and B2B patching. This script
    decided if day0 patching or b2b patching needs to be applied based on
    environment variable VMWARE_B2B.
"""
import logging
import sys
import os
from os.path import join, dirname
logger = logging.getLogger(__name__)

sys.path.append(join(
    dirname(__file__),
    "patches",
    "libs",
    "feature-state"))
from fss_utils import getTargetFSS

# To disable B2B we should either create env-variable VMWARE_B2B equal to 0,
# or define target FSS VMWARE_B2B=False. Note if targetFSS is not defined we
# will still execute B2B
if os.environ.get('VMWARE_B2B') == '1' or getTargetFSS('VMWARE_B2B') == True:
    logger.debug("Apply B2B patching")
    from update_script_b2b import *
else:
    logger.debug("Apply day0 patching")
    from update_script_day0_patching import *
