tarBin
This commit is contained in:
		
							parent
							
								
									8adbf84362
								
							
						
					
					
						commit
						b15e85474e
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -20,6 +20,7 @@ const dateFormat = "20060102_150405"
 | 
				
			||||||
const keySplitCharacter = ":"
 | 
					const keySplitCharacter = ":"
 | 
				
			||||||
const metadataPrefix = "_metadata"
 | 
					const metadataPrefix = "_metadata"
 | 
				
			||||||
const metadataKeyTemplate = metadataPrefix + "/%s"
 | 
					const metadataKeyTemplate = metadataPrefix + "/%s"
 | 
				
			||||||
 | 
					const tarBin = "/bin/tar"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Snapshot contains metadata about a single snapshot
 | 
					// Snapshot contains metadata about a single snapshot
 | 
				
			||||||
type Snapshot struct {
 | 
					type Snapshot struct {
 | 
				
			||||||
| 
						 | 
					@ -137,7 +138,7 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
 | 
				
			||||||
		return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
 | 
							return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = exec.Command("/bin/tar", "-acf", tmpSnapshotArchivePath, "./").Run()
 | 
						err = exec.Command(tarBin, "-acf", tmpSnapshotArchivePath, "./").Run()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err)
 | 
							return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -191,7 +192,7 @@ func (s *SnapshotProcessor) RestoreSnapshot(key string, newAppName string) error
 | 
				
			||||||
		return fmt.Errorf("getting the archive from S3 error: %v", err)
 | 
							return fmt.Errorf("getting the archive from S3 error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = exec.Command("/usr/bin/tar", "-axf", tmpSnapshotArchivePath).Run()
 | 
						err = exec.Command(tarBin, "-axf", tmpSnapshotArchivePath).Run()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return fmt.Errorf("unarchiving error: %v", err)
 | 
							return fmt.Errorf("unarchiving error: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue