def change_omsagent_configuration_port(omsagent_incoming_port, configuration_path):
    '''
    Changing the omsagent configuration port if required
    :param omsagent_incoming_port:
    :param configuration_path:
    '''
    with open(configuration_path, "rt") as fin:
        with open("tmp.txt", "wt") as fout:
            for line in fin:
                fout.write(line.replace(omsagent_default_incoming_port, omsagent_incoming_port))
    command_tokens = ["sudo", "mv", "tmp.txt", configuration_path]
    write_new_content = subprocess.Popen(command_tokens, stdout=subprocess.PIPE)
    time.sleep(3)
    o, e = write_new_content.communicate()
    if e is not None:
        handle_error(e, error_response_str="Error: could not change omsagent configuration port in ." + configuration_path)
        return False
    # set read permissions to file after recreated with the move command
    set_file_read_permissions(configuration_path)
    print_ok("Omsagent incoming port was changed in configuration - " + configuration_path)
    return True

    Changing the omsagent configuration port if required
    :param omsagent_incoming_port:
    :param configuration_path:
    
DataConnectors/CEF/cef_installer.py