Skip to content

Commit

Permalink
Merge pull request #156 from nicolasbock/keep
Browse files Browse the repository at this point in the history
Add option to keep working directory
  • Loading branch information
nicolasbock authored May 30, 2024
2 parents 5a34474 + a1a9f16 commit 196841e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions athena-processor.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
processor:
batch-comments-every: 1m
base-tmpdir: "/tmp/athena"
keep-processing-output: true
subscribers:
sosreports:
sf-comment-enabled: true
Expand Down
9 changes: 5 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ func NewMonitor() Monitor {
}

type Processor struct {
ReportsUploadPath string `yaml:"reports-upload-dir"`
BatchCommentsEvery string `yaml:"batch-comments-every"`
BaseTmpDir string `yaml:"base-tmpdir"`
SubscribeTo map[string]Subscriber `yaml:"subscribers,omitempty"`
ReportsUploadPath string `yaml:"reports-upload-dir"`
BatchCommentsEvery string `yaml:"batch-comments-every"`
BaseTmpDir string `yaml:"base-tmpdir"`
KeepProcessingOutput bool `yaml:"keep-processing-output"`
SubscribeTo map[string]Subscriber `yaml:"subscribers,omitempty"`
}

func NewProcessor() Processor {
Expand Down
4 changes: 4 additions & 0 deletions pkg/processor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ func NewReportRunner(cfg *config.Config, dbConn *gorm.DB, sf common.SalesforceCl
}

func (runner *ReportRunner) Clean() error {
if runner.Config.Processor.KeepProcessingOutput {
log.Infof("Keeping base direcotry %s for report %s", runner.Basedir, runner.Name)
return nil
}
log.Infof("Removing base directory: %s for report: %s", runner.Basedir, runner.Name)
return os.RemoveAll(runner.Basedir)
}
Expand Down

0 comments on commit 196841e

Please sign in to comment.