def check_multi_homing(workspace_id):
    """
    Check if there is already an agent install and connected to a different worksapce
    """

    grep1 = subprocess.Popen(["grep", "-ri", "WORKSPACE_ID=", oms_agent_extract_ws_id_url], stdout=subprocess.PIPE)
    grep2 = subprocess.Popen(["grep", "-v", "%"], stdin=grep1.stdout, stdout=subprocess.PIPE)
    o, e = grep2.communicate()
    output_decoded = o.decode(encoding='UTF-8')
    if e is not None:
        print_error("Failed to check potential multi homing issue")
    elif output_decoded is not None and output_decoded != "":
        # Extract the workspace id from the agent configuration
        current_ws_id = re.search("(?<=WORKSPACE_ID=).*", output_decoded).group(0)
        if current_ws_id != workspace_id:
            print_error("This server already has an omsagent installed and connected to a different workspace- {}. \nThe omsagent"
                        " does not currently support sending data to multiple workspaces (multi-homing).\nIf you wish to overeide this workspace connection"
                        " please remove the existing omsagent using the command: \"{}\" \nand rerun this installation script"
                        .format(current_ws_id, oms_agent_purge_command))
            print_error("For more on this issue please visit " + oms_agent_documentation)
            sys.exit()

    Check if there is already an agent install and connected to a different worksapce
    
DataConnectors/CEF/cef_installer.py