Commit 34655721 authored by Daniel Robinson's avatar Daniel Robinson Committed by Ivan Aguilar
Browse files

Workaround for aws:runDocument bookkeeping bug

parent adf57071
......@@ -22,7 +22,6 @@ import (
......@@ -92,10 +91,53 @@ func (exec ExecDocumentImpl) ExecuteDocument(config contracts.Configuration, con
InstancePluginsInformation: pluginInput,
docStore := executer.NewDocumentFileStore(documentID, appconfig.DefaultLocationOfCurrent,
&docState, docmanager.NewDocumentFileMgr(context, appconfig.DefaultDataStorePath, appconfig.DefaultDocumentRootDirName, appconfig.DefaultLocationOfState))
docStore := executer.NewDocumentFileStore(documentID, appconfig.DefaultLocationOfCurrent, &docState,
cancelFlag := task.NewChanneledCancelFlag()
resultChannels = exec.DocExecutor.Run(cancelFlag, &docStore)
return resultChannels, nil
// Workaround to keep this plugin from overwriting the DocumentState of the top-level document.
// Up until version 3.0.732.0, this plugin always failed to write the DocumentState to file due to a
// path calculation bug. In 3.0.732.0, the path calculation bug was fixed, and the plugin
// started overwriting the top-level document's DocumentState, which sometimes interfered with
// plugins in the top-level document that executed after this one. NoOpDocumentMgr is meant
// to keep this plugin from overwriting the state of the top-level document. However, it does
// not persist the DocumentState over a reboot, and it does not track the status (e.g. "pending",
// "current", "corrupt") of the document. Longer-term, we may want to implement proper DocumentState
// bookkeeping for the documents executed by this plugin.
type NoOpDocumentMgr struct {
context context.T
state contracts.DocumentState
func NewNoOpDocumentMgr(ctx context.T) *NoOpDocumentMgr {
return &NoOpDocumentMgr{
func (m *NoOpDocumentMgr) MoveDocumentState(fileName, srcLocationFolder, dstLocationFolder string) {
// No-op
m.context.Log().Debugf("NoOpDocumentMgr.MoveDocumentState(%s, %s, %s)", fileName, srcLocationFolder, dstLocationFolder)
func (m *NoOpDocumentMgr) PersistDocumentState(fileName, locationFolder string, state contracts.DocumentState) {
m.context.Log().Debugf("NoOpDocumentMgr.PersistDocumentState(%s, %s, %+v)", fileName, locationFolder, state)
m.state = state
func (m *NoOpDocumentMgr) GetDocumentState(fileName, locationFolder string) contracts.DocumentState {
m.context.Log().Debugf("NoOpDocumentMgr.GetDocumentState(%s, %s)", fileName, locationFolder)
m.context.Log().Warn("NoOpDocumentMgr.GetDocumentState() called, consider using a persistent DocumentMgr")
return m.state
func (m *NoOpDocumentMgr) RemoveDocumentState(fileName, locationFolder string) {
// No-op
m.context.Log().Debugf("NoOpDocumentMgr.RemoveDocumentState(%s, %s)", fileName, locationFolder)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment