worker: keep output directory in /var/cache
Let's keep this on the same filesystem as the osbuild store, and in particular stay away from /var/tmp and its scary semantics. We are not aware of any issues caused by /var/tmp, but getting rid of it means we don't have to think about that when debugging, if nothing else. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
5ae5cdbf9e
commit
f0b7cc0973
3 changed files with 9 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ import (
|
|||
|
||||
type OSBuildKojiJobImpl struct {
|
||||
Store string
|
||||
Output string
|
||||
KojiServers map[string]koji.GSSAPICredentials
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +55,7 @@ func (impl *OSBuildKojiJobImpl) kojiUpload(file *os.File, server, directory, fil
|
|||
}
|
||||
|
||||
func (impl *OSBuildKojiJobImpl) Run(job worker.Job) error {
|
||||
outputDirectory, err := ioutil.TempDir("/var/tmp", "osbuild-worker-*")
|
||||
outputDirectory, err := ioutil.TempDir(impl.Output, job.Id().String()+"-*")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating temporary output directory: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
|
||||
type OSBuildJobImpl struct {
|
||||
Store string
|
||||
Output string
|
||||
KojiServers map[string]koji.GSSAPICredentials
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +63,7 @@ func osbuildStagesToRPMs(stages []osbuild.StageResult) []koji.RPM {
|
|||
}
|
||||
|
||||
func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
||||
outputDirectory, err := ioutil.TempDir("/var/tmp", "osbuild-worker-*")
|
||||
outputDirectory, err := ioutil.TempDir(impl.Output, job.Id().String()+"-*")
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating temporary output directory: %v", err)
|
||||
}
|
||||
|
|
@ -154,7 +155,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
Datastore: options.Datastore,
|
||||
}
|
||||
|
||||
tempDirectory, err := ioutil.TempDir("/var/tmp", "osbuild-worker-vmware-*")
|
||||
tempDirectory, err := ioutil.TempDir(impl.Output, job.Id().String()+"-vmware-*")
|
||||
if err != nil {
|
||||
r = append(r, err)
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ func main() {
|
|||
log.Fatal("CACHE_DIRECTORY is not set. Is the service file missing CacheDirectory=?")
|
||||
}
|
||||
store := path.Join(cacheDirectory, "osbuild-store")
|
||||
output := path.Join(cacheDirectory, "output")
|
||||
_ = os.Mkdir(output, os.ModeDir)
|
||||
|
||||
kojiServers := make(map[string]koji.GSSAPICredentials)
|
||||
for server, creds := range config.KojiServers {
|
||||
|
|
@ -152,10 +154,12 @@ func main() {
|
|||
jobImpls := map[string]JobImplementation{
|
||||
"osbuild": &OSBuildJobImpl{
|
||||
Store: store,
|
||||
Output: output,
|
||||
KojiServers: kojiServers,
|
||||
},
|
||||
"osbuild-koji": &OSBuildKojiJobImpl{
|
||||
Store: store,
|
||||
Output: output,
|
||||
KojiServers: kojiServers,
|
||||
},
|
||||
"koji-init": &KojiInitJobImpl{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue