Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"getBuildLogs": (mCb) => {
// jobLogs: '/api/repos/#OWNER#/#REPO#/logs/#BUILD_NUMBER#/#JOB_ID#'
async.eachSeries(jobIds, (oneJobId, fCb) => {
params = {
uri: utils.getDomain(opts.settings.domain + config.api.url.jobLogs).replace('#JOB_ID#', oneJobId).replace("#BUILD_NUMBER#", oneBranch.number).replace("#OWNER#", opts.settings.owner).replace("#REPO#", opts.params.repo.split("/")[1]),
headers: config.headers,
json: true
};
params.headers['Authorization'] = opts.settings.ciToken;
if (opts.settings.domain) {
params.headers['Host'] = opts.settings.domain.replace(/https?:\/\//, "");
}
opts.log.debug(params);
request.get(params, (error, resp, body) => {
if (body && body.error) {
opts.log.error(body);
}
utils.checkError(error, { code: 997 }, cb, () => {
if (body && Array.isArray(body) && body.length > 0){
glob(job_spec, {}, function (err, files) {
// got job json files
if (!files) files = [];
async.eachSeries( files, function(file, callback) {
// foreach job file
if (file.match(/\/(\w+)(\-detached)?\.json$/)) {
var job_id = RegExp.$1;
fs.readFile( file, { encoding: 'utf8' }, function(err, data) {
var job = null;
try { job = JSON.parse(data); } catch (e) {;}
if (job) {
self.logDebug(5, "Recovering job data: " + job_id + ": " + file, job);
if (job.detached && job.pid && self.isProcessRunning(job.pid)) {
// detached job is still running, resume it!
self.logDebug(5, "Detached PID " + job.pid + " is still alive, resuming job as if nothing happened");
self.activeJobs[ job_id ] = job;
self.kids[ job.pid ] = { pid: job.pid };
return callback();
ACL.prototype.can = function (user, mode, resource, callback, options) {
debug('Can ' + (user || 'an agent') + ' ' + mode + ' ' + resource + '?')
var self = this
var accessType = 'accessTo'
var acls = possibleACLs(resource, self.suffix)
options = options || {}
// If it is an ACL, only look for control this resource
if (self.isAcl(resource)) {
mode = 'Control'
}
async.eachSeries(
acls,
// Looks for ACL, if found, looks for a rule
function (acl, next) {
debug('Check if acl exist: ' + acl)
// Let's see if there is a file..
self.fetch(acl, function (err, graph) {
if (err || !graph || graph.statements.length === 0) {
// TODO
// If no file is found and we want to Control,
// we should not be able to do that!
// Control is only to Read and Write the current file!
// if (mode === 'Control') {
// return next(new Error('You can\'t Control an unexisting file'))
// }
if (err) debug('Error: ' + err)
grunt.registerMultiTask('clean', 'Clean files and folders.', function() {
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({
force: grunt.option('force') === true,
'no-write': grunt.option('no-write') === true
});
var done = this.async();
// Clean specified files / dirs.
var files = this.filesSrc;
async.eachSeries(files, function (filepath, cb) {
clean(filepath, options, cb);
}, function (err) {
grunt.log.ok(files.length + ' ' + grunt.util.pluralize(files.length, 'path/paths') + ' cleaned.');
done(err);
});
});
ObservationModel.find({}).lean().exec(function(err, observations) {
async.eachSeries(observations, function(observation, done) {
var form = {
formId: formId
};
// TODO don't move properties that are not in the form, ie accuracy
for (var property in observation.properties) {
if (property === 'timestamp' || !fieldMap[property]) continue;
form[property] = observation.properties[property];
delete observation.properties[property];
}
observation.properties.forms = [form];
ObservationModel.findByIdAndUpdate(observation._id, observation, {overwrite: true, new: true}, function(err) {
done(err);
async.eachSeries(zip(testSuites), function(suite, cb) {
var suiteName = suite[0];
var tests = suite[1];
async.eachSeries(zip(tests), function(test, cb) {
var name = suiteName + '.' + test[0];
var fn = test[1];
Promise.using(models.sequelize.sync({
force: true
}), fn).then(function() {
console.log(clc.green(name + ' ' + 'PASSED'));
cb();
}).catch(function() {
console.error(clc.red(name + ' ' + 'FAILED'));
cb();
});
}, cb);
}, function() {
gTTS.prototype.save = function (save_file, callback) {
var self = this;
async.eachSeries(self.text_parts, function (part, cb) {
var idx = self.text_parts.indexOf(part);
var headers = self.getHeader();
var payload = self.getPayload(part, idx);
if (self.debug) {
console.log(payload);
}
var writeStream = fs.createWriteStream(save_file, { flags: idx > 0 ? 'a' : 'w' });
request({
uri: self.GOOGLE_TTS_URL,
headers: headers,
qs: payload,
method: 'GET'
})
.pipe(writeStream);
EC2.describeInstances(function(error, data) {
console.log ("Filtering instances");
if (error) { cb && cb (error);}
else {
async.eachSeries (data.Reservations, function (reservation, done){
async.eachSeries (reservation.Instances, function (instance, _done){
if (instance.PublicDnsName){
EC2.describeInstanceAttribute ({Attribute: "userData", InstanceId:instance.InstanceId}, function (err, data){
if (!err && data.UserData && data.UserData.Value){
var user_data = new Buffer(data.UserData.Value, 'base64').toString ();
if (user_data) {
try{user_data = JSON.parse (user_data);}
catch (err){}
}
if (user_data.type && instance_user_data.type && user_data.type === instance_user_data.type){
var id = instance.InstanceId;
if (!instance_map[id]){
instances.push ({id:id, dns:instance.PublicDnsName,
user_data:user_data});
instance_map[id] = true;
}
entry.loaded = new Promise(function (resolve, reject) {
async.eachSeries(_this.localePaths, function (path, cb) {
_this.loadLocalePath(locale, path).done(function () { return cb(); }, function (err) { return cb(err); });
}, function (err) {
if (err) {
reject(err);
}
else {
resolve(true);
}
});
});
}
gulp.task('breezeServerBuild', function(done) {
var solutionFileNames = [];
_buildSlnDirs.forEach(function(bsd) {
[].push.apply(solutionFileNames, glob.sync(bsd + "*.sln"));
});
async.eachSeries(solutionFileNames, function(sfn, cb1) {
sfn = path.normalize(sfn);
gutil.log('Building solution: ' + sfn );
msBuildSolution(sfn, cb1);
}, done);
});