def read_yaml_file_section(filepath, control_console, section):
    sections = control_console.eval("\n        local file = require('fio').open('{}')\n        if file == nil then\n            error('Failed to open instance config file')\n        end\n\n        local buf = {{}}\n        while true do\n            local val = file:read(1024)\n            if val == nil then\n                error('Failed to read from instance config file')\n            elseif val == '' then\n                break\n            end\n            table.insert(buf, val)\n        end\n        file:close()\n\n        local data = table.concat(buf, '')\n        local ok, ret = pcall(require('yaml').decode, data)\n        if not ok then\n            error('Failed to decode instance config from YAML')\n        end\n        return ret\n    ".format(filepath))
    if (section not in sections):
        errmsg = 'File {} does not contain section: {}'.format(filepath, section)
        raise CartridgeException(cartridge_errcodes.MISSED_SECTION, errmsg)
    return sections[section]
def read_yaml_file_section(filepath, control_console, section):
    sections = control_console.eval("\n        local file = require('fio').open('{}')\n        if file == nil then\n            error('Failed to open instance config file')\n        end\n\n        local buf = {{}}\n        while true do\n            local val = file:read(1024)\n            if val == nil then\n                error('Failed to read from instance config file')\n            elseif val ==  then\n                break\n            end\n            table.insert(buf, val)\n        end\n        file:close()\n\n        local data = table.concat(buf, )\n        local ok, ret = pcall(require('yaml').decode, data)\n        if not ok then\n            error('Failed to decode instance config from YAML')\n        end\n        return ret\n    ".format(filepath))
    if (section not in sections):
        errmsg = 'File {} does not contain section: {}'.format(filepath, section)
        raise CartridgeException(cartridge_errcodes.MISSED_SECTION, errmsg)
    return sections[section]