Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static resolvePath(target, point = config('agent:vm:mount_point')) {
target = Utils.resolve(target);
if (config('agent:requires_vm')) {
target = path.join(point, target);
}
return target;
}
}
get persistent_folders() {
var folders = {};
var key = config('agent:requires_vm') ? 'agent:vm' : 'paths';
var base = config(key + ':persistent_folders');
return _.reduce(this.options.persistent_folders, (folders, folder) => {
var origin = path.join(base, this.manifest.namespace, this.name, folder);
folders[origin] = folder;
return folders;
}, {});
}
return async(this, function* () {
if (params.filename) {
this.showFilename();
return 0;
}
var generator = new lazy.Generator(this.ui);
var manifest = config("manifest");
var cwd = params.path || this.cwd;
var file = path.join(cwd, manifest);
var manifest_exists = yield fsAsync.exists(file);
if (manifest_exists && !params.force) {
this.ui.fail(this.ui.tKeyPath(this.name, "already_exists"), manifest);
return 1;
}
var systemsData = yield generator.findSystems(cwd);
log.debug('generator.findSystems(\'%s\')', cwd);
if (_.isEmpty(systemsData)) {
this.ui.fail(this.ui.tKeyPath(this.name, "not_found"));
systemsData = { [lazy.example_system.name]: lazy.example_system };
}
describe("with a vm is running", function() {
this.timeout(10000);
var name = config("agent:vm:name");
var data = "";
var _subscription;
before(() => {
_subscription = subscribe('agent.#', (event) => {
if (event.type == "ssh" && (event.context == "stdout" || event.context == "stderr")) {
data += event.data.toString();
}
});
});
after(() => {
_subscription.unsubscribe();
});
beforeEach(() => {
data = "";
var portscanner = require('portscanner');
var url = require('url');
var nativeNet = require('net');
var os = require('os');
var { isIPv4 } = require('net');
var lazy = lazy_require({
Netmask : ['netmask'],
hostonly : ['azk/agent/vm'],
VM : ['azk/agent/vm'],
connectivity : 'connectivity',
nodeRetry : 'retry',
});
var portrange = config("agent:portrange_start");
var cache_key = "agent:dns:file_cache";
var net = {
getPort(host = 'localhost') {
var port = portrange;
portrange += 1;
return this
.checkPort(port, host)
.then((avaibly) => {
return (avaibly) ? port : this.getPort(host);
});
},
checkPort(port, host = 'localhost') {
return ninvoke(portscanner, "checkPortStatus", port, host)