Merge pull request #404 from resin-io/reboot-shutdown-force

Add a device shutdown command, and allow forcing reboot and shutdown
This commit is contained in:
Pablo Carranza Vélez 2016-10-27 18:42:30 -03:00 committed by GitHub
commit 0bf6bcc430
6 changed files with 70 additions and 3 deletions

View File

@ -73,4 +73,12 @@ limitations under the License.
alias: 'k'
};
exports.forceUpdateLock = {
signature: 'force',
parameter: 'force',
description: 'force action if the update lock is set',
boolean: true,
alias: 'f'
};
}).call(this);

View File

@ -141,11 +141,25 @@ limitations under the License.
signature: 'device reboot <uuid>',
description: 'restart a device',
help: 'Use this command to remotely reboot a device\n\nExamples:\n\n $ resin device reboot 23c73a1',
options: [commandOptions.forceUpdateLock],
permission: 'user',
action: function(params, options, done) {
var resin;
resin = require('resin-sdk');
return resin.models.device.reboot(params.uuid).nodeify(done);
return resin.models.device.reboot(params.uuid, options).nodeify(done);
}
};
exports.shutdown = {
signature: 'device shutdown <uuid>',
description: 'shutdown a device',
help: 'Use this command to remotely shutdown a device\n\nExamples:\n\n $ resin device shutdown 23c73a1',
options: [commandOptions.forceUpdateLock],
permission: 'user',
action: function(params, options, done) {
var resin;
resin = require('resin-sdk');
return resin.models.device.shutdown(params.uuid, options).nodeify(done);
}
};

View File

@ -38,6 +38,7 @@ Now you have access to all the commands referenced below.
- [device rm &#60;uuid&#62;](#device-rm-60-uuid-62-)
- [device identify &#60;uuid&#62;](#device-identify-60-uuid-62-)
- [device reboot &#60;uuid&#62;](#device-reboot-60-uuid-62-)
- [device shutdown &#60;uuid&#62;](#device-shutdown-60-uuid-62-)
- [device public-url enable &#60;uuid&#62;](#device-public-url-enable-60-uuid-62-)
- [device public-url disable &#60;uuid&#62;](#device-public-url-disable-60-uuid-62-)
- [device public-url &#60;uuid&#62;](#device-public-url-60-uuid-62-)
@ -339,6 +340,26 @@ Examples:
$ resin device reboot 23c73a1
### Options
#### --force, -f &#60;force&#62;
force action if the update lock is set
## device shutdown &#60;uuid&#62;
Use this command to remotely shutdown a device
Examples:
$ resin device shutdown 23c73a1
### Options
#### --force, -f &#60;force&#62;
force action if the update lock is set
## device public-url enable &#60;uuid&#62;
Use this command to enable public URL for a device

View File

@ -61,3 +61,10 @@ exports.wifiKey =
parameter: 'key'
description: 'wifi key, if network is wifi'
alias: 'k'
exports.forceUpdateLock =
signature: 'force'
parameter: 'force'
description: 'force action if the update lock is set'
boolean: true
alias: 'f'

View File

@ -201,10 +201,27 @@ exports.reboot =
$ resin device reboot 23c73a1
'''
options: [ commandOptions.forceUpdateLock ]
permission: 'user'
action: (params, options, done) ->
resin = require('resin-sdk')
resin.models.device.reboot(params.uuid).nodeify(done)
resin.models.device.reboot(params.uuid, options).nodeify(done)
exports.shutdown =
signature: 'device shutdown <uuid>'
description: 'shutdown a device'
help: '''
Use this command to remotely shutdown a device
Examples:
$ resin device shutdown 23c73a1
'''
options: [ commandOptions.forceUpdateLock ]
permission: 'user'
action: (params, options, done) ->
resin = require('resin-sdk')
resin.models.device.shutdown(params.uuid, options).nodeify(done)
exports.enableDeviceUrl =
signature: 'device public-url enable <uuid>'

View File

@ -53,7 +53,7 @@
"resin-image-fs": "^2.1.2",
"resin-image-manager": "^4.0.0",
"resin-pine": "^1.3.0",
"resin-sdk": "^5.3.5",
"resin-sdk": "^5.4.0",
"resin-settings-client": "^3.5.0",
"resin-sync": "^3.0.0",
"resin-vcs": "^2.0.0",