Fix/handle faults during create shell#181
Conversation
|
@masterzen this would solve some long standing issues in packer |
masterzen
left a comment
There was a problem hiding this comment.
Sorry for the late review, I was abroad with few network access.
This looks correct and I'm inclined to merge the PR, but would you mind taking a look at my suggestions?
Thanks!
|
Since the ParseOpenShellResponse and ParseExecuteCommandResponse functions are now almost identical, we could also extract the common parts into it's own function so you get something like this: What are your thoughts on that? func parseResponse(response string, expectedAction, idXPath, errorMsg string) (string, error) {
...
}
func ParseOpenShellResponse(response string) (string, error) {
return parseResponse(
response,
"http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse",
"//rsp:ShellId",
"error during shell creation",
)
}
func ParseExecuteCommandResponse(response string) (string, error) {
return parseResponse(
response,
"http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandResponse",
"//rsp:CommandId",
"error during command execution",
)
} |
Indeed, even better! |
|
Sure, I'll create a commit for this when I can. Probably tomorrow morning. |
|
are we good to merge this? @Jbekker |
We are! @masterzen, please take a look. |
This is to resolve two open issues, #176 and #41
c.exitCode.