shell: make require take a tag
This commit is contained in:
+3
-3
@@ -14,7 +14,7 @@ const assert = require('assert'),
|
||||
path = require('path'),
|
||||
paths = require('./paths.js'),
|
||||
safe = require('safetydance'),
|
||||
shell = require('./shell.js');
|
||||
shell = require('./shell.js')('support');
|
||||
|
||||
// the logic here is also used in the cloudron-support tool
|
||||
const AUTHORIZED_KEYS_CMD = path.join(__dirname, 'scripts/remotesupport.sh');
|
||||
@@ -34,7 +34,7 @@ function sshInfo() {
|
||||
}
|
||||
|
||||
async function getRemoteSupport() {
|
||||
const [error, stdoutResult] = await safe(shell.promises.sudo('support', [ AUTHORIZED_KEYS_CMD, 'is-enabled', sshInfo().filePath ], { captureStdout: true }));
|
||||
const [error, stdoutResult] = await safe(shell.promises.sudo([ AUTHORIZED_KEYS_CMD, 'is-enabled', sshInfo().filePath ], { captureStdout: true }));
|
||||
if (error) throw new BoxError(BoxError.FS_ERROR, error);
|
||||
|
||||
return stdoutResult.trim() === 'true';
|
||||
@@ -45,7 +45,7 @@ async function enableRemoteSupport(enable, auditSource) {
|
||||
assert.strictEqual(typeof auditSource, 'object');
|
||||
|
||||
const si = sshInfo();
|
||||
const [error] = await safe(shell.promises.sudo('support', [ AUTHORIZED_KEYS_CMD, enable ? 'enable' : 'disable', si.filePath, si.user ], {}));
|
||||
const [error] = await safe(shell.promises.sudo([ AUTHORIZED_KEYS_CMD, enable ? 'enable' : 'disable', si.filePath, si.user ], {}));
|
||||
if (error) throw new BoxError(BoxError.FS_ERROR, error);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_SUPPORT_SSH, auditSource, { enable });
|
||||
|
||||
Reference in New Issue
Block a user