forked from RackHD/on-tasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap-winpe.js
63 lines (52 loc) · 1.52 KB
/
bootstrap-winpe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2015, EMC, Inc.
'use strict';
var di = require('di');
module.exports = bootstrapWinPEJobFactory;
di.annotate(bootstrapWinPEJobFactory, new di.Provide('Job.WinPE.Bootstrap'));
di.annotate(bootstrapWinPEJobFactory,
new di.Inject(
'Job.Base',
'Logger',
'Assert',
'Util'
)
);
function bootstrapWinPEJobFactory(BaseJob, Logger, assert, util) {
var logger = Logger.initialize(bootstrapWinPEJobFactory);
/**
*
* @param {Object} options
* @param {Object} context
* @param {String} taskId
* @constructor
*/
function BootstrapWinPEJob(options, context, taskId) {
BaseJob.call(this, logger, options, context, taskId);
this.nodeId = this.context.target;
}
util.inherits(BootstrapWinPEJob, BaseJob);
/**
* @memberOf BootstrapWinPEJob
*/
BootstrapWinPEJob.prototype._run = function() {
this._subscribeRequestProfile(function() {
return this.options.profile;
});
this._subscribeRequestProperties(function() {
return this.options;
});
this._subscribeRequestCommands(function() {
return {
identifier: this.nodeId,
tasks: [{ cmd: '' }]
};
});
this._subscribeRespondCommands(function() {
logger.info('Node is online and waiting for tasks', {
id: this.context.target
});
this._done();
});
};
return BootstrapWinPEJob;
}