#!/usr/bin/env python
#
# Copyright 2020 VMware, Inc.  All rights reserved. -- VMware Confidential
#

import logging
import os
import sys

vmware_python_path = os.getenv('VMWARE_PYTHON_PATH')
if vmware_python_path and os.path.exists(vmware_python_path):
    sys.path.append(vmware_python_path)

from cis.utils import readprop

hvc_prop = '/usr/lib/vmware-hvc/config/hvc.properties'

logger = logging.getLogger(__name__)


def is_vmc_gateway():
    is_gateway_str = readprop(hvc_prop, "hvc.link.v2")
    if (is_gateway_str == None):
        return False
    if (is_gateway_str.lower() == 'true'):
        logger.info("Gateway appliance detected")
        return True
    else:
        return False