lib/utils/job-utils/os-repo-tool.js
function _extractEsxBootCfgValue(data, pattern) {
        var pos = data.indexOf(pattern);
        if (pos >= 0) {
            pos += pattern.length;
            var lineEndPos = data.indexOf('\n', pos);
            if (lineEndPos >= 0) {
                return data.substring(pos, lineEndPos);
            }
        }
        return '';
    }
function _extractEsxBootCfgValue(data, pattern) {
        var pos = data.indexOf(pattern);
        if (pos >= 0) {
            pos += pattern.length;
            var lineEndPos = data.indexOf('\n', pos);
            if (lineEndPos >= 0) {
                return data.substring(pos, lineEndPos);
            }
        }
        return '';
    }
function _extractEsxBootCfgValue ( data , pattern ) { var pos = data . indexOf ( pattern ) ; if ( pos >= 0 ) { pos += pattern . length ; var lineEndPos = data . indexOf ( '\n' , pos ) ; if ( lineEndPos >= 0 ) { return data . substring ( pos , lineEndPos ) ; } } return '' ; }
Extract the value from a whole data by key.
@param {String} data - The whole data that cotains all key-value pairs
@param {String} key - The key for target value including the key-value delimiter
@return {String} The extracted value; If key is not exsited, return empty.
@example
// return "12xyz - pmq"
_extractEsxiBootCfgValue("key1=abc def\nkey2=12xyz - pmq\nkey3=pmq,abq", "key2=")
Extract the value from a whole data by key .