Sink pool cleanup and organization; better future support when we add more sinks

This commit is contained in:
Dane Everitt
2022-01-23 09:57:25 -05:00
parent 2a9c9e893e
commit a4904365c9
6 changed files with 79 additions and 49 deletions

View File

@@ -507,9 +507,9 @@ func (ip *InstallationProcess) Execute() (string, error) {
return r.ID, nil
}
// Streams the output of the installation process to a log file in the server configuration
// directory, as well as to a websocket listener so that the process can be viewed in
// the panel by administrators.
// StreamOutput streams the output of the installation process to a log file in
// the server configuration directory, as well as to a websocket listener so
// that the process can be viewed in the panel by administrators.
func (ip *InstallationProcess) StreamOutput(ctx context.Context, id string) error {
reader, err := ip.client.ContainerLogs(ctx, id, types.ContainerLogsOptions{
ShowStdout: true,
@@ -521,7 +521,7 @@ func (ip *InstallationProcess) StreamOutput(ctx context.Context, id string) erro
}
defer reader.Close()
err = system.ScanReader(reader, ip.Server.InstallSink().Push)
err = system.ScanReader(reader, ip.Server.Sink(InstallSink).Push)
if err != nil {
ip.Server.Log().WithFields(log.Fields{"container_id": id, "error": err}).Warn("error processing install output lines")
}