-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wsman firmware update task refine #538
Conversation
Refine emc diag fimrware update file upload method Change HTTP code Fix unit test bug Fix unit test coverage Fix indent Fix conflict
spec/lib/jobs/wsman-control-spec.js
Outdated
{status: "Success"}, | ||
{status: "Success"} | ||
]; | ||
job.firmwareUpdateCallback(callBackData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
spec/lib/jobs/wsman-control-spec.js
Outdated
"body": { | ||
"response": "Request Submitted!" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
spec/lib/jobs/wsman-control-spec.js
Outdated
shareName: "emc", | ||
sharePassworrd: "usr", | ||
shareType: 2, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
if (!data){ | ||
throw new errors.NotFoundError('Dell FirmwareUpdate web service for '+ name +' is not defined in wsmanConfig.json.'); //jshint ignore:line | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
lib/jobs/wsman-control.js
Outdated
if (isSuccessful){ | ||
self._done(); | ||
} | ||
else { | ||
console.log("gg") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
} | ||
} | ||
}); | ||
} | ||
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
lib/jobs/wsman-control.js
Outdated
}; | ||
logger.info('Before calling the endpoint :'); | ||
return self.clientRequest(apiHost,path,method,request); | ||
return self.clientRequest(apiHost, path, method, request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
|
||
if (options.shareType === "cifs" || options.shareType === "CIFS") { | ||
this.shareConfig.shareType = 2; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
spec/lib/jobs/wsman-control-spec.js
Outdated
{status: "Success"}, | ||
{status: "Success"} | ||
]; | ||
job.firmwareUpdateCallback(callBackData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
spec/lib/jobs/wsman-control-spec.js
Outdated
"body": { | ||
"response": "Request Submitted!" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
spec/lib/jobs/wsman-control-spec.js
Outdated
shareName: "emc", | ||
sharePassworrd: "usr", | ||
shareType: 2, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
if (!data){ | ||
throw new errors.NotFoundError('Dell FirmwareUpdate web service for '+ name +' is not defined in wsmanConfig.json.'); //jshint ignore:line | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
lib/jobs/wsman-control.js
Outdated
if (isSuccessful){ | ||
self._done(); | ||
} | ||
else { | ||
console.log("gg") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
} | ||
} | ||
}); | ||
} | ||
|
||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
lib/jobs/wsman-control.js
Outdated
}; | ||
logger.info('Before calling the endpoint :'); | ||
return self.clientRequest(apiHost,path,method,request); | ||
return self.clientRequest(apiHost, path, method, request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon.
lib/jobs/wsman-control.js
Outdated
|
||
if (options.shareType === "cifs" || options.shareType === "CIFS") { | ||
this.shareConfig.shareType = 2; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary semicolon.
ef434ee
to
4cee316
Compare
spec/lib/jobs/wsman-control-spec.js
Outdated
}); | ||
|
||
beforeEach(function(){ | ||
job = new WsmanJob({}, {"nodeId": nodeId}, uuid.v4()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New job in before
spec/lib/jobs/wsman-control-spec.js
Outdated
|
||
it('Should get error: data is Failed', function(){ | ||
var callBackData = [{status: "Failed"}]; | ||
expect(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add fail+success in date
Please add |
}, | ||
node: nodeId | ||
}; | ||
var shareConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'shareConfig' is defined but never used.
var failureFound = false; | ||
if (data !== null && data.length > 0) { | ||
data.forEach(function (item) { | ||
if ( !(item.status === 'undefined' || item.status === null || item.status === ""|| failureFound == true)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected '===' and instead saw '=='.
password :"", | ||
}; | ||
this.rebootNeeded = options.rebootNeeded || "YES"; | ||
this.dellConfigs = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
user :"", | ||
password :"", | ||
}; | ||
this.rebootNeeded = options.rebootNeeded || "YES"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
if (options.shareFolderType === "cifs" || options.shareFolderType === "CIFS") { | ||
this.shareConfig.shareType = 2; | ||
} | ||
this.targetConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
this.shareConfig.shareType = 0; | ||
} | ||
if (options.shareFolderType === "cifs" || options.shareFolderType === "CIFS") { | ||
this.shareConfig.shareType = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
shareType: 2 | ||
}; | ||
if (options.shareFolderType === "nfs" || options.shareFolderType === "NFS") { | ||
this.shareConfig.shareType = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
wsmanFirmwareUpdateJob.super_.call(this, logger, options, context, taskId); | ||
|
||
this.nodeId = this.context.target; | ||
this.shareConfig = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
function wsmanFirmwareUpdateJob(options, context, taskId) { | ||
wsmanFirmwareUpdateJob.super_.call(this, logger, options, context, taskId); | ||
|
||
this.nodeId = this.context.target; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
* @constructor | ||
*/ | ||
function wsmanFirmwareUpdateJob(options, context, taskId) { | ||
wsmanFirmwareUpdateJob.super_.call(this, logger, options, context, taskId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
|
||
describe('handle cases for _handleAsyncRequest function', function(){ | ||
beforeEach(function() { | ||
job.wsman = new WsmanTool(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WSMANTOOL init parameter
var self = this; | ||
|
||
self.dellConfigs = configuration.get('dell'); | ||
if (!self.dellConfigs || !self.dellConfigs.gateway) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dellConfigs.firmware
ceeaacf
to
ebea69b
Compare
@@ -0,0 +1,204 @@ | |||
//Copyright 2016, EMC, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright
if ( !(item.status === 'undefined' || item.status === null || item.status === ""|| failureFound === true)){ | ||
if(item.status === 'Failed') { | ||
isSuccessful = false; | ||
failureFound = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference with isSuccessful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the array has multiple result field only isSussessful is insufficient to judge. Add a "failurlfound" flag just like a break operation(break could not be used in foreach).
@@ -0,0 +1,16 @@ | |||
// Copyright 2016, EMC, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copyright
|
||
/* | ||
* Initialize basic configuration for the job | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused '*'
{ | ||
var logger = Logger.initialize(wsmanFirmwareUpdateJobFactory); | ||
/** | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused '*'
Please squash the commits |
093d032
to
eabe80e
Compare
* @constructor | ||
*/ | ||
function wsmanFirmwareUpdateJob(options, context, taskId) { | ||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
7ec98c5
to
9725e80
Compare
*/ | ||
function wsmanFirmwareUpdateJob(options, context, taskId) { | ||
wsmanFirmwareUpdateJob.super_.call(this, logger, options, context, taskId); | ||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a strict mode function is executed using function invocation, its 'this' value will be undefined.
9725e80
to
3aa0b92
Compare
Refine Format Refine based on hound Refine format Remove debug info Refine code based on review comments Refine this to self Fix conflict Fix conflict Retest CI Refine copyrights fields Change copyrights Fix this ->self Remove debug Fix hound Fix hound message
3aa0b92
to
6c99533
Compare
Background
The original WSMAN based job is out of date after SMI service updated its input parameters. And also it is lack of unit test and option schema check. Currently we refine all WSMAN implementation and aimed to integrate SMI service with RackHD and replace the RACADM. We refined the WSMAN work job arch. Now it use the new common WSMAN base job as base classs and WSMAN tool as util to send out request to SMI service.
Detail
Refined the job arch to use WSMAN base job as base.
Refined payload send to SMI service.
Refined input parameter to task.
Add task schema for task parameter.
Add unit test for WSMAN control job.
Add unit test for task schema.
Test Result
Tested pass on Dell R730 server.
wsman-control.js Unit test coverage: 97%
Review: @yaolingling @anhou @lanchongyizu @AlaricChan