UNPKG

cloudcms-cli

Version:
71 lines (66 loc) 2.4 kB
var helper = require("../../../helper"); var AbstractCommand = require("../../abstract"); class ApplyPatchesCommand extends AbstractCommand { constructor() { super({ "group": "patch", "name": "apply", "description": "Applies a patch to a datastore", "schema": { "properties": [{ "name": "datastoreTypeId", "type": "string", "description": "Enter the data store type ID", "args": ["datastoreTypeId", "type"], "default": "cluster" }, { "name": "datastoreId", "type": "string", "description": "Enter the data store ID", "args": ["datastoreId", "id"], "default": "default" }, { "name": "patch", "type": "boolean", "description": "Identifies the patch to apply", "required": true, "args": ["patch", "p"] }, { "name": "force", "type": "boolean", "description": "Whether to force the patch application", "required": false, "default": false, "args": ["force", "f"] }, { "name": "username", "type": "string", "description": "Admin username", "required": true, "args": ["username", "u"] }, { "name": "password", "type": "string", "description": "Admin password", "required": true, "hidden": true, "args": ["password", "p"] }] } }); } handle(options, callback) { var patchIds = options.patch; if (typeof(patchIds) === "string") { patchIds = [patchIds]; } // call workhorse function helper.applyPatches(options.datastoreTypeId, options.datastoreId, patchIds, options.force, options.username, options.password, function(err) { callback(err); }); } } module.exports = ApplyPatchesCommand;