-
Notifications
You must be signed in to change notification settings - Fork 88
Adds utility to reuse a single PowerShell session #1775
Adds utility to reuse a single PowerShell session #1775
Conversation
what's the impact on time consumption ? |
client_plugin/utils/fs/fs_windows.go
Outdated
powershell = "powershell" | ||
diskNotFound = "DiskNotFound" | ||
// maxDiskAttachWaitSec is the max time to wait for a disk to be attached. | ||
// TODO: Reduce disk attach wait time once parallel disk identification |
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.
Do you plan to address this TODO in a follow-up PR? If not, can you please file an issue?
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.
I've filed an issue in #1780.
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.
I've updated the comment in 0653f74.
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.
Addressing via #1991
if err != nil { | ||
log.WithField("err", err).Fatal("Failed to create a PowerShell session") | ||
fmt.Println("Failed to create a PowerShell session") | ||
os.Exit(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.
Can this error be a temporary issue that can be recovered later? If the answer is yes, we should not exit the plugin. Instead, we can log the error, and retry in the next attempt. That means you may need to move this out of the init 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.
Since this is happening in init
, the Windows service itself will fail to start. Therefore, I suggest we still keep this as is.
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.
Looks Good. See comments inline.
default: | ||
log.WithFields(log.Fields{"err": err, "out": string(out)}).Warn("Couldn't emit error, continuing.. ") | ||
log.WithFields(log.Fields{"err": err, "stdout": stdout, |
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.
log.Fields{"err": err
Is this gonna work in case where err isn't valid?
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.
There's a err != nil
check, and it would print nil
even if that wasn't in place.
"sync" | ||
|
||
log "github.com/Sirupsen/logrus" | ||
ps "github.com/gorillalabs/go-powershell" |
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.
A bit concerned about this usage. The last checkin was on Feb 6th. What other alternatives do we have?
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.
Mark has approved use of that package. The package is very small in itself, so it shouldn't be of too much concern.
60f4a50
to
ee3ef33
Compare
0653f74
to
6eef93c
Compare
This commit adds the powershell utility that reuses a single session to execute commands over the plugin's lifetime.
6eef93c
to
53d5e13
Compare
Description
This PR adds the
powershell
utility that reuses a single session to execute commands over the plugin's lifetime.Tests
The
test-e2e-windows
target passes locally, and following is the tail'd output.