mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-21 17:56:57 +00:00
Merge pull request #295 from resin-io/fix/delete-device-resource-on-errors
Remove registered device resource in case of errors in quickstart
This commit is contained in:
commit
65bc22c02c
@ -226,6 +226,10 @@ limitations under the License.
|
|||||||
var message;
|
var message;
|
||||||
message = 'Initializing a device requires administration permissions\ngiven that we need to access raw devices directly.\n';
|
message = 'Initializing a device requires administration permissions\ngiven that we need to access raw devices directly.\n';
|
||||||
return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type], message);
|
return helpers.sudo(['os', 'initialize', temporalPath, '--type', application.device_type], message);
|
||||||
|
})["catch"](function(error) {
|
||||||
|
return resin.models.device.remove(device.uuid)["finally"](function() {
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).then(function(device) {
|
}).then(function(device) {
|
||||||
|
@ -299,6 +299,12 @@ exports.init =
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ], message)
|
helpers.sudo([ 'os', 'initialize', temporalPath, '--type', application.device_type ], message)
|
||||||
|
|
||||||
|
# Make sure the device resource is removed if there is an
|
||||||
|
# error when configuring or initializing a device image
|
||||||
|
.catch (error) ->
|
||||||
|
resin.models.device.remove(device.uuid).finally ->
|
||||||
|
throw error
|
||||||
.then (device) ->
|
.then (device) ->
|
||||||
console.log('Done')
|
console.log('Done')
|
||||||
return device.uuid
|
return device.uuid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user