Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (error) {
return callbackError(error);
}
var parts = data.toString().split('\r\n');
var xml;
// If there is more than one part (and the \r\n wasnt the final marker).
if (parts.length > 1 && parts[1].length > 0) {
xml = parts[1];
} else {
xml = parts[0];
}
if (parseXml) {
var parser = new xml2js.Parser();
error = null;
parser.on('error', function (e) { error = e; });
parser.parseString(xml);
if (parser.resultObject) {
xml = parser.resultObject;
}
}
callback(error, xml);
});
};
if (error) {
return callbackError(error);
}
var parts = data.toString().split('\r\n');
var xml;
// If there is more than one part (and the \r\n wasnt the final marker).
if (parts.length > 1 && parts[1].length > 0) {
xml = parts[1];
} else {
xml = parts[0];
}
if (parseXml) {
var parser = new xml2js.Parser();
error = null;
parser.on('error', function (e) { error = e; });
parser.parseString(xml);
if (parser.resultObject) {
xml = parser.resultObject;
}
}
callback(error, xml);
});
};
function _getTestCredentialData(callback) {
var file = process.env['AZURE_HDINSIGHT_CREDENTIALFILE'];
if (!file) {
file = __dirname + '/creds.xml';
}
var parser = new xml2js.Parser();
fs.readFile(file, 'utf-8', function(err, data) {
parser.parseString(data, function(err, result) {
var creds = result.ArrayOfAzureTestCredentials.AzureTestCredentials;
if (!_.isArray(creds)) {
creds = [
creds
];
}
var retval = { };
for (var i = 0; i < creds.length; i++) {
var cred = {
credsName : creds[i].CredentialsName[0],
subscriptionId : creds[i].SubscriptionId[0],
dnsName : creds[i].DnsName[0],
cluster : creds[i].Cluster[0],
user : creds[i].AzureUserName[0],
this._readData(name, function (error, data) {
if (!error) {
if (parseXml) {
var parser = new xml2js.Parser();
parser.on('error', function (e) { error = e; });
parser.parseString(data);
if (parser.resultObject) {
data = parser.resultObject;
}
}
callback(error, data);
} else {
callback(error);
}
});
};