system: expose getDisks only for tests
This commit is contained in:
@@ -4,7 +4,6 @@ exports = module.exports = {
|
||||
reboot,
|
||||
getInfo,
|
||||
getUbuntuVersion,
|
||||
getDisks,
|
||||
getSwaps,
|
||||
checkDiskSpace,
|
||||
getMemory,
|
||||
@@ -16,6 +15,9 @@ exports = module.exports = {
|
||||
runSystemChecks,
|
||||
getProvider,
|
||||
getCpus,
|
||||
|
||||
// exported for testing
|
||||
_getDisks: getDisks
|
||||
};
|
||||
|
||||
const apps = require('./apps.js'),
|
||||
@@ -87,6 +89,7 @@ async function getSwaps() {
|
||||
return swaps;
|
||||
}
|
||||
|
||||
// this gets information based on mounted filesystems
|
||||
async function getDisks() {
|
||||
const [dfError, dfEntries] = await safe(df.disks());
|
||||
if (dfError) throw new BoxError(BoxError.FS_ERROR, `Error running df: ${dfError.message}`);
|
||||
@@ -313,6 +316,7 @@ async function getLogs(unit, options) {
|
||||
return logStream;
|
||||
}
|
||||
|
||||
// this gets block devices as opposed to mounted filesystems. this is used for configuring backups and volumes in the frontend
|
||||
async function getBlockDevices() {
|
||||
const result = await shell.spawn('lsblk', ['--paths', '--json', '--list', '--fs', '--output', '+rota'], { encoding: 'utf8' });
|
||||
const info = safe.JSON.parse(result);
|
||||
|
||||
Reference in New Issue
Block a user