refactor session handling
This commit is contained in:
parent
06a3e0f503
commit
e7dd3987ef
|
|
@ -517,8 +517,9 @@ func (s *Manager) index() []byte {
|
|||
cwd := sess.Core.CWD()
|
||||
be := sess.Core.BackendName()
|
||||
model := sess.Core.ModelName()
|
||||
agent := sess.Core.AgentName()
|
||||
sess.mu.RUnlock()
|
||||
fmt.Fprintf(&sb, "%s\t%s\t%s\t%s\t%s\n", id, state, cwd, be, model)
|
||||
fmt.Fprintf(&sb, "%s\t%s\t%s\t%s\t%s\t%s\n", id, state, cwd, be, model, agent)
|
||||
}
|
||||
s.mu.RUnlock()
|
||||
return []byte(sb.String())
|
||||
|
|
@ -631,7 +632,7 @@ func (s *Manager) createSession(args []string) error {
|
|||
"execute": execute.Decl(cwd, execOpts...),
|
||||
})
|
||||
|
||||
env := agent.BuildAgentEnv(cfg, newDisp(), cwd, []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + execute.MountPath(uname)})
|
||||
rt := agent.BuildRuntime(cfg, newDisp(), cwd, []string{"OLLIE_SESSION_ID=" + sessID, "OLLIE_UNAME=" + uname, "OLLIE=" + execute.MountPath(uname)})
|
||||
|
||||
core = agent.NewAgentCore(agent.AgentCoreConfig{
|
||||
Backend: be,
|
||||
|
|
@ -641,7 +642,7 @@ func (s *Manager) createSession(args []string) error {
|
|||
SessionID: sessID,
|
||||
Uname: uname,
|
||||
CWD: cwd,
|
||||
Env: env,
|
||||
Runtime: rt,
|
||||
NewDispatcher: newDisp,
|
||||
Log: s.cfg.Sink.NewLogger("core"),
|
||||
})
|
||||
|
|
@ -716,7 +717,7 @@ func (s *Manager) renameSession(old, new string) error {
|
|||
}
|
||||
|
||||
// LoadAgentConfig resolves and loads the config for a named agent.
|
||||
// Returns nil if the config file does not exist; BuildAgentEnv handles nil configs.
|
||||
// Returns nil if the config file does not exist; BuildRuntime handles nil configs.
|
||||
func LoadAgentConfig(agentsDir, name string, open func(string) (*os.File, error)) *config.Config {
|
||||
if open == nil {
|
||||
open = os.Open
|
||||
|
|
|
|||
Reference in New Issue