Skip to content

Commit

Permalink
feat: supporting local connector in inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
ssmirr committed Jun 3, 2020
1 parent deecaa1 commit 625e16f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function main(env_address, criteria_path, connector) {

async function selectConnectorFromInventory(connectorType, connectorInfo, argv) {
// TODO: is this always needed?
let env_address = connectorInfo.target || connectorInfo.instance || connectorInfo.name;
let env_address = connectorInfo.target || connectorInfo.instance || connectorInfo.name || 'local';
let criteria_path = connectorInfo.criteria_path || argv.criteria_path;

if (!criteria_path) {
Expand Down Expand Up @@ -78,10 +78,13 @@ async function selectConnectorFromInventory(connectorType, connectorInfo, argv)
} else if (connectorType === 'ssh' && connectorInfo.target.match(/[@:]+/)) {
name = connectorInfo.target;
opts['privateKey'] = connectorInfo.private_key;
} else if (connectorType === 'local' || connectorType === 'localhost') {
name = argv.env_address;
}

if(name !== null) {
connector = Connector.getConnector(connectorType, name, opts);
}
if(name !== null){
connector = Connector.getConnector(connectorType, name, opts);
}

if (!connector) {
console.error(chalk.red(' => No running environment could be found with the given parameters:'), connectorType, connectorInfo);
Expand Down

0 comments on commit 625e16f

Please sign in to comment.