示例#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")
	}
}