Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev committed Nov 17, 2023
1 parent dc4051d commit d7551dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/photographer/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ type SnapshotExec struct {
octezNodeBinPath string
}

func newSnapshotExec(snapshotsPath, tezosPath, octezNodePath string) *SnapshotExec {
func NewSnapshotExec(snapshotsPath, tezosPath, octezNodePath string) *SnapshotExec {
return &SnapshotExec{snapshotsPath, tezosPath, octezNodePath}
}

func (s *SnapshotExec) CreateSnapshot(historyMode snapshot.HistoryModeType) {
log.Println("Creating snapshot.")
script := "mkdir -p " + s.snapshotsPath + " && cd " + s.snapshotsPath + " && " + s.octezNodeBinPath + " snapshot export --data-dir " + s.tezosPath

if historyMode == snapshot.ROLLING {
Expand Down Expand Up @@ -63,6 +64,7 @@ func (s *SnapshotExec) DeleteLocalSnapshots() {
}

func (s *SnapshotExec) execScript(script string) (bytes.Buffer, bytes.Buffer) {
log.Printf("Executing script: %q. \n", script)
cmd := exec.Command("sh", "-c", script)
var stdout, stderr bytes.Buffer
cmd.Stdout = &stdout
Expand Down
2 changes: 1 addition & 1 deletion cmd/photographer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func task() {
octezNodepath := util.GetEnvString("OCTEZ_NODE_PATH", "/usr/local/bin/octez-node")
tezosPath := util.GetEnvString("TEZOS_PATH", "/var/run/tezos/node")

snapshotExec := newSnapshotExec(snapshotsPath, octezNodepath, tezosPath)
snapshotExec := NewSnapshotExec(snapshotsPath, octezNodepath, tezosPath)

if bucketName == "" {
log.Fatalln("The BUCKET_NAME environment variable is empty.")
Expand Down

0 comments on commit d7551dd

Please sign in to comment.