Skip to content

Commit

Permalink
Fix CloudWatch issue and Spacing in Output
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam Bharuka committed Nov 15, 2017
1 parent 518833a commit f7f9dd0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package iomodule

import (
"bufio"
"bytes"
"fmt"
"io"

Expand All @@ -38,17 +37,15 @@ func (c CommandOutput) Read(log log.T, reader *io.PipeReader) {
scanner.Split(bufio.ScanBytes)

outputLimit := 0
var buffer bytes.Buffer
for scanner.Scan() {
// Check if size of output is greater than the output limit
outputLimit++
if outputLimit > c.OutputLimit {
break
}
buffer.WriteString(scanner.Text())
*c.OutputString = fmt.Sprintf("%v%v", *c.OutputString, scanner.Text())
}
log.Debugf("Number of bytes written to console output: %v", outputLimit)
*c.OutputString = fmt.Sprintf("%v%v", *c.OutputString, buffer.String())

if err := scanner.Err(); err != nil {
log.Error("Error with the scanner while reading the stream")
Expand Down
7 changes: 5 additions & 2 deletions agent/framework/runpluginutil/runpluginutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ func runPlugin(
default:
executePlugin(context, p, pluginName, config, cancelFlag, output)
}

pluginConfig := iohandler.DefaultOutputConfig()

res.Code = output.GetExitCode()
Expand All @@ -271,7 +270,11 @@ func executePlugin(context context.T,
var propID string
var err error
if config.PluginName == config.PluginID {
propID, err = GetPropertyName(config.Properties) //V10 Schema
if pluginName == appconfig.PluginNameCloudWatch {
propID = appconfig.PluginNameCloudWatch
} else {
propID, err = GetPropertyName(config.Properties) //V10 Schema
}
} else {
propID = config.PluginID //V20 Schema
}
Expand Down
2 changes: 1 addition & 1 deletion agent/longrunning/manager/invoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func Invoke(log logger.T, pluginID string, res *contracts.PluginResult, orchestr
}

default:
log.Errorf("Allowed Values of StartType: Enabled | Disabled")
log.Errorf("Allowed Values of StartType: Enabled | Disabled but provided value is: %s", startType)
CreateResult("Allowed Values of StartType: Enabled | Disabled",
contracts.ResultStatusFailed, res)
}
Expand Down
2 changes: 1 addition & 1 deletion agent/plugins/lrpminvoker/invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (p *Plugin) Execute(context context.T, config contracts.Configuration, canc
} else {
property := p.prepareForStart(log, config, cancelFlag, output)
output.SetOutput(property)
output.SetStdout(setting.StartType)
output.AppendInfo(setting.StartType)
}

return
Expand Down

0 comments on commit f7f9dd0

Please sign in to comment.