Skip to content

Commit

Permalink
Merge branch 'Eywek-improv/agent' into new-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Mar 16, 2018
2 parents a60580a + e13f39c commit 3e259dd
Show file tree
Hide file tree
Showing 42 changed files with 26 additions and 5,713 deletions.
2 changes: 1 addition & 1 deletion lib/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const fclone = require('fclone');
var conf = require('../constants.js');
var Client = require('./Client');
var Common = require('./Common');
var KMDaemon = require('./Interactor/InteractorDaemonizer');
var KMDaemon = require('keymetrics-agent/src/InteractorClient');
var Config = require('./tools/Config');
var Modularizer = require('./API/Modules/Modularizer.js');
var path_structure = require('../paths.js');
Expand Down
33 changes: 1 addition & 32 deletions lib/API/Configuration.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

var Password = require('../Interactor/Password.js');
var Common = require('../Common.js');
var cst = require('../../constants.js');
var UX = require('./CliUx');
var chalk = require('chalk');
var async = require('async');
var Configuration = require('../Configuration.js');
//@todo double check that imported methods works
var InteractorDaemonizer = require('../Interactor/InteractorDaemonizer');
var InteractorDaemonizer = require('keymetrics-agent/src/InteractorClient');

module.exports = function(CLI) {

Expand Down Expand Up @@ -63,36 +62,6 @@ module.exports = function(CLI) {
return false;
}

/**
* Specific when setting pm2 password
* Used for restricted remote actions
* Also alert Interactor that password has been set
*/
if (key.indexOf('pm2:passwd') > -1) {
value = Password.generate(value);
Configuration.set(key, value, function(err) {
if (err)
return cb ? cb(Common.retErr(err)) : that.exitCli(cst.ERROR_EXIT);
InteractorDaemonizer.launchRPC(that._conf, function(err) {
if (err) {
displayConf('pm2', function() {
return cb ? cb(null, {success:true}) : that.exitCli(cst.SUCCESS_EXIT)
});
return false;
}
InteractorDaemonizer.rpc.passwordSet(function() {
InteractorDaemonizer.disconnectRPC(function() {
displayConf('pm2', function() {
return cb ? cb(null, {success:true}) : that.exitCli(cst.SUCCESS_EXIT);
});
});
});
return false;
});
});
return false;
}

/**
* Set value
*/
Expand Down
12 changes: 8 additions & 4 deletions lib/API/Interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var chalk = require('chalk');
var async = require('async');
var path = require('path');
var fs = require('fs');
var KMDaemon = require('../Interactor/InteractorDaemonizer');
var KMDaemon = require('keymetrics-agent/src/InteractorClient');
var pkg = require('../../package.json')

module.exports = function(CLI) {

Expand Down Expand Up @@ -45,7 +46,8 @@ module.exports = function(CLI) {
KMDaemon.launchAndInteract(that._conf, {
secret_key : secret_key || null,
public_key : public_key || null,
machine_name : machine_name || null
machine_name : machine_name || null,
pm2_version: pkg.version
}, function(err, dt) {
if (err) {
return cb ? cb(err) : that.exitCli(cst.ERROR_EXIT);
Expand Down Expand Up @@ -118,7 +120,8 @@ module.exports = function(CLI) {
public_key : null,
secret_key : null,
machine_name : null,
info_node : null
info_node : null,
pm2_version: pkg.version
}, function(err, dt) {
if (err) {
Common.printError(err);
Expand All @@ -143,7 +146,8 @@ module.exports = function(CLI) {
public_key : public_key,
secret_key : cmd,
machine_name : machine,
info_node : info_node.infoNode || null
info_node : info_node.infoNode || null,
pm2_version: pkg.version
}

KMDaemon.launchAndInteract(that._conf, infos, function(err, dt) {
Expand Down
9 changes: 6 additions & 3 deletions lib/API/Keymetrics/cli-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ var chalk = require('chalk');
var async = require('async');
var path = require('path');
var fs = require('fs');
var KMDaemon = require('../../Interactor/InteractorDaemonizer');
var KMDaemon = require('keymetrics-agent/src/InteractorClient');
var KM = require('./kmapi.js');
var Table = require('cli-table-redemption');
var open = require('../../tools/open.js');
var promptly = require('promptly');
var pkg = require('../../../package.json')

module.exports = function(CLI) {

Expand Down Expand Up @@ -127,7 +128,8 @@ module.exports = function(CLI) {
function linkOpenExit(target_bucket) {
KMDaemon.launchAndInteract(cst, {
public_key : target_bucket.public_id,
secret_key : target_bucket.secret_id
secret_key : target_bucket.secret_id,
pm2_version: pkg.version
}, function(err, dt) {
open('https://app.keymetrics.io/#/r/' + target_bucket.public_id);
setTimeout(function() {
Expand Down Expand Up @@ -194,7 +196,8 @@ module.exports = function(CLI) {

KMDaemon.launchAndInteract(cst, {
public_key : target_bucket.public_id,
secret_key : target_bucket.secret_id
secret_key : target_bucket.secret_id,
pm2_version: pkg.version
}, function(err, dt) {
linkOpenExit(target_bucket);
});
Expand Down
9 changes: 6 additions & 3 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

var debug = require('debug')('pm2:client');
var Common = require('./Common.js');
var KMDaemon = require('./Interactor/InteractorDaemonizer.js');
var KMDaemon = require('keymetrics-agent/src/InteractorClient');
var rpc = require('pm2-axon-rpc');
var async = require('async');
var axon = require('pm2-axon');
Expand All @@ -15,6 +15,7 @@ var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var shelljs = require('shelljs');
var pkg = require('../package.json')

function noop() {}

Expand Down Expand Up @@ -79,7 +80,8 @@ Client.prototype.start = function(cb) {
KMDaemon.launchAndInteract(that.conf, {
machine_name : that.machine_name,
public_key : that.public_key,
secret_key : that.secret_key
secret_key : that.secret_key,
pm2_version : pkg.version
}, function(err, data, interactor_proc) {
that.interactor_process = interactor_proc;
});
Expand Down Expand Up @@ -278,7 +280,8 @@ Client.prototype.launchDaemon = function(opts, cb) {
KMDaemon.launchAndInteract(that.conf, {
machine_name : that.machine_name,
public_key : that.public_key,
secret_key : that.secret_key
secret_key : that.secret_key,
pm2_version : pkg.version
}, function(err, data, interactor_proc) {
that.interactor_process = interactor_proc;
return cb(null, child);
Expand Down
2 changes: 1 addition & 1 deletion lib/Common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var isBinary = require('./tools/isbinaryfile.js');
var cst = require('../constants.js');
var extItps = require('./API/interpreter.json');
var Config = require('./tools/Config');
var KMDaemon = require('./Interactor/InteractorDaemonizer.js');
var KMDaemon = require('keymetrics-agent/src/InteractorClient');

var Common = module.exports;

Expand Down
50 changes: 0 additions & 50 deletions lib/Interactor/Cipher.js

This file was deleted.

Loading

0 comments on commit 3e259dd

Please sign in to comment.