-
Notifications
You must be signed in to change notification settings - Fork 18
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
redfishpower: add option to test host errors #145
Conversation
Problem: The "cycle" configs and commands have clear cut and paste errors from the off config/commands. Fix cut and paste errors.
Problem: Typical configurations are documented in redfishpower(8) except for the common header. Document common header configuration.
Problem: The tabbing / whitespace in a few functions was wrong. Fix the tabbing / whitespace.
Problem: Some variables are initialized to NULL when it's unnecessary. Do not initialize variables unless its necessary.
Problem: Code in settimeout() may index outside of array bounds. Only check if a value is non-NULL if the prior value was non-NULL.
Problem: The following terms are used interchangeably within the redfishpower code: path & url data & postdata Solution: Consistently use the term "path" to describe "paths" input by the user for configuration and use the term "postdata" for http post data. The term "url" should only be used when the full URL is constructed (i.e. when http:// is prefixed). Update terms in the manpage as well.
Problem: The item destructor was not set for the delayedcmds list. This is because items are typically moved from delayedcmds to activecmds, but there is always the chance of an error occuring. Set the item destructor for the delayedcmds list.
Problem: Globals are initialized in a init function, but we manually cleanup globals inside main(). Add a cleanup function to call when cleaning up globals.
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.
LGTM, just a couple minor suggestions.
if (av[0]) | ||
if (av[0]) { | ||
(*path) = xstrdup(av[0]); | ||
if (av[1]) | ||
(*postdata) = xstrdup(av[1]); | ||
if (av[1]) | ||
(*postdata) = xstrdup(av[1]); | ||
} |
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.
unrelated but the parens on the LHS are unnecessary.
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.
ya know, I always paren these de-reference assignments ... I don't know why. Somehow makes it more clear to me that's an assignment? Or maybe I picked it up via another project.
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, if they are helping!
src/redfishpower/redfishpower.c
Outdated
@@ -125,6 +126,7 @@ static struct option longopts[] = { | |||
{"offpostdata", required_argument, 0, 'G' }, | |||
{"cyclepostdata", required_argument, 0, 'D' }, | |||
{"test-mode", no_argument, 0, 'T' }, | |||
{"test-error", required_argument, 0, 'E' }, |
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.
Suggestion: use a more descriptive option name like --test-fail-power-cmd-hosts
Problem: It would be nice to cover failures in redfishpower's test mode. When running under --test-mode, support a new --test-error option that allows users to set a group of hosts to permanently return errors when communicating with the hosts.
Problem: There is no coverage for when targetted hosts return errors. Add basic coverage in t0029-redfish.t.
tweaked option command per comment above, setting MWP, thanks! |
Problem: It would be nice to cover failures in redfishpower's test mode.
When running under --test-mode, support a new --test-error option that allows users to set a group of hosts to permanently return errors when communicating with the hosts.
threw in a bunch of cleanups from another branch, hope that's ok