From 28092034088597a68e327dd25caae82d3a503dee Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 3 May 2018 18:25:32 -0700 Subject: [PATCH] agent: restore proxy snapshot but still Kill proxies --- agent/agent.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/agent.go b/agent/agent.go index 6f7531ed96..2d431be924 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -368,6 +368,11 @@ func (a *Agent) Start() error { // to allow setting the data dir for demos and so on for the agent, // so do the check above instead. 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() @@ -1289,7 +1294,7 @@ func (a *Agent) ShutdownAgent() error { // Stop the proxy manager // 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 { a.logger.Printf("[WARN] agent: error shutting down proxy manager: %s", err) }