volumes: set hostPath based on volume id

this is required for the file browser to work which does operations
based on the id

fixes #789
This commit is contained in:
Girish Ramakrishnan
2021-06-24 16:59:47 -07:00
parent 097a7d6b60
commit 1ce4875db1
6 changed files with 22 additions and 12 deletions
+2 -1
View File
@@ -31,10 +31,11 @@ async function add(req, res, next) {
assert.strictEqual(typeof req.body, 'object');
if (typeof req.body.name !== 'string') return next(new HttpError(400, 'name must be a string'));
if (typeof req.body.hostPath !== 'string') return next(new HttpError(400, 'hostPath must be a string'));
if (typeof req.body.mountType !== 'string') return next(new HttpError(400, 'mountType must be a string'));
if (typeof req.body.mountOptions !== 'object') return next(new HttpError(400, 'mountOptions must be a object'));
if ('hostPath' in req.body && typeof req.body.hostPath !== 'string') return next(new HttpError(400, 'hostPath must be a string'));
req.clearTimeout(); // waiting for mount can take time
const [error, id] = await safe(volumes.add(req.body, auditSource.fromRequest(req)));