@@ -29,6 +29,7 @@ func Run(cfg *config.Config) error {
2929 }
3030 if len (cfg .VolumeDirsArchive ) > 0 {
3131 for _ , vda := range cfg .VolumeDirsArchive {
32+ fmt .Printf ("VDA: %s\n " , vda )
3233 unarchiveDir (vda , cfg )
3334 }
3435 if * cfg .InitMode {
@@ -103,7 +104,7 @@ func volumeDirArchiveWatcher(cfg *config.Config) error {
103104 continue
104105 }
105106
106- err := unarchiveFile (event .Name , cfg )
107+ err := unarchiveDir (event .Name , cfg )
107108 if err != nil {
108109 log .Println ("Error:" , err )
109110 }
@@ -214,13 +215,15 @@ func sendWebHook(cfg *config.Config) {
214215}
215216
216217func unarchiveDir (path string , cfg * config.Config ) error {
217- files , err := ioutil .ReadDir (path )
218+ kuberPath := path + "/..data"
219+ files , err := ioutil .ReadDir (kuberPath )
218220 if err != nil {
219221 return err
220222 }
221223
222224 for _ , file := range files {
223225 fullFilePath := path + "/" + file .Name ()
226+ fmt .Printf ("file: %s" , fullFilePath )
224227 err := unarchiveFile (fullFilePath , cfg )
225228 if err != nil {
226229 return err
@@ -230,6 +233,8 @@ func unarchiveDir(path string, cfg *config.Config) error {
230233}
231234
232235func unarchiveFile (path string , cfg * config.Config ) error {
236+ outFileName := * cfg .DirForUnarchive + "/" + filepath .Base (path )[0 :len (filepath .Base (path ))- 3 ]
237+ log .Printf ("Unarhive file from %s to %s" , path , outFileName )
233238
234239 if path [len (path )- 3 :] != ".gz" {
235240 return fmt .Errorf ("File %s is not a .gz archive. Do nothing" , path )
@@ -247,9 +252,6 @@ func unarchiveFile(path string, cfg *config.Config) error {
247252 defer gzipReader .Close ()
248253
249254 // Uncompress to a writer. We'll use a file writer
250- outFileName := * cfg .DirForUnarchive + "/" + filepath .Base (path )[0 :len (filepath .Base (path ))- 3 ]
251- // fmt.Println(outFileName)
252-
253255 outfileWriter , err := os .Create (outFileName )
254256 if err != nil {
255257 return err
0 commit comments