agent: restore proxy snapshot but still Kill proxies

This commit is contained in:
Mitchell Hashimoto 2018-05-03 18:25:32 -07:00
parent 718aabe35f
commit 2809203408
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
1 changed files with 6 additions and 1 deletions

View File

@ -368,6 +368,11 @@ func (a *Agent) Start() error {
// to allow setting the data dir for demos and so on for the agent, // to allow setting the data dir for demos and so on for the agent,
// so do the check above instead. // so do the check above instead.
a.proxyManager.DataDir = filepath.Join(a.config.DataDir, "proxy") a.proxyManager.DataDir = filepath.Join(a.config.DataDir, "proxy")
// Restore from our snapshot (if it exists)
if err := a.proxyManager.Restore(a.proxyManager.SnapshotPath()); err != nil {
a.logger.Printf("[WARN] agent: error restoring proxy state: %s", err)
}
} }
go a.proxyManager.Run() go a.proxyManager.Run()
@ -1289,7 +1294,7 @@ func (a *Agent) ShutdownAgent() error {
// Stop the proxy manager // Stop the proxy manager
// NOTE(mitchellh): we use Kill for now to kill the processes since // NOTE(mitchellh): we use Kill for now to kill the processes since
// snapshotting isn't implemented. This should change to Close later. // there isn't a clean way to cleanup the managed proxies. This is coming
if err := a.proxyManager.Kill(); err != nil { if err := a.proxyManager.Kill(); err != nil {
a.logger.Printf("[WARN] agent: error shutting down proxy manager: %s", err) a.logger.Printf("[WARN] agent: error shutting down proxy manager: %s", err)
} }