예제 #1
0
파일: rkt.go 프로젝트: blablacar/dgr
func importInternalAci(filename string) {
	content, err := dist.Asset(filename)
	if err != nil {
		logs.WithE(err).WithField("aci", filename).Fatal("Cannot found internal aci")
	}
	tmpFile := "/tmp/" + RandStringBytesMaskImpr(20) + ".aci"
	if err := ioutil.WriteFile(tmpFile, content, 0644); err != nil {
		logs.WithE(err).WithField("aci", filename).Fatal("Failed to write tmp aci to /tmp/tmp.aci")
	}
	defer os.Remove(tmpFile)
	if _, err := Home.Rkt.FetchInsecure(tmpFile); err != nil {
		logs.WithE(err).Fatal("Failed to import internal image to rkt")
	}
}
예제 #2
0
파일: rkt.go 프로젝트: puckel/dgr
func importInternalAci(filename string) {
	filepath := "dist/bindata/" + filename
	content, err := dist.Asset(filepath)
	if err != nil {
		logs.WithE(err).WithField("aci", filepath).Fatal("Cannot found internal aci")
	}
	tmpFile := "/tmp/" + RandStringBytesMaskImpr(20) + ".aci"
	if err := ioutil.WriteFile(tmpFile, content, 0644); err != nil {
		logs.WithE(err).WithField("aci", filepath).Fatal("Failed to write tmp aci to /tmp/tmp.aci")
	}
	defer os.Remove(tmpFile)
	if _, err := Home.Rkt.Fetch(tmpFile); err != nil { // TODO does not support concurrency
		logs.WithE(err).Fatal("Failed to import internal image to rkt")
	}
}