-
Notifications
You must be signed in to change notification settings - Fork 76
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
support IPDU(severtech-CWG-16H2C454) power control(power on/off) #533
Conversation
if (_.contains(result.stdout.contains, 'INTEGER: on') || | ||
_.contains(result.stdout.contains, 'INTEGER: idleOn')) { | ||
if (_.contains(result.stdout, 'INTEGER: on') || | ||
_.contains(result.stdout, 'INTEGER: idleOn')) { |
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.
Are you sure result.stdout.contains is incorrect data path? If you are not sure about this, you should find the old devices and try on it. Otherwise, below lines are safer.
_.contains(result.stdout, 'INTEGER: on') ||
_.contains(result.stdout, 'INTEGER: idleOn' ||
_.contains(result.stdout.contains, 'INTEGER: on' ||
_.contains(result.stdout.contains, 'INTEGER: idleOn'
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.
ok,I will find a old one to do some test
if (_.contains(result.stdout.contains, 'INTEGER: off') || | ||
_.contains(result.stdout.contains, 'INTEGER: idleOff')) { | ||
if (_.contains(result.stdout, 'INTEGER: off') || | ||
_.contains(result.stdout, 'INTEGER: idleOff')) { |
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.
The same as above comment.
Confused by 'PowerControllByRackhd', a more meaningful or specific title is better |
@@ -23,27 +23,27 @@ function serverTechObmServiceFactory(Promise, BaseObmService, _) { | |||
util.inherits(ServerTechObmService, BaseObmService); | |||
|
|||
ServerTechObmService.prototype.reboot = function() { | |||
return this._runInternal(this.mibPowerCommand + '.' + this.options.config.port, 'i', '3'); | |||
return this._runInternal([this.mibPowerCommand + '.' + this.options.config.port, 'i', '3']); |
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 background of changing it to array, it does't work in old way?
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.
ServerTechObmService.prototype._runInternal this function allow to accept 2 arguments : command and file (file can be null).
however , "return this._runInternal(this.mibPowerCommand + '.' + this.options.config.port, 'i', '3')" without the brackets actually send 3 arguments to the function ,and it will consider the string "i " as file value, it is not a available snmp command and will run failed . so we need the brackets to make all the arguments value as the first arguments "command".
5ce98c4
to
6623e08
Compare
Background:
test and implement IPDU power control of rackhd , model is CWG-16H2C454.
Details:
code change in :lib/services/servertech-obm-service.js .
test : Do manual test of power on and power off with rackhd api
code review : @anhou @bbcyyb @pengz1 @panpan0000