forked from security/hakurei
internal/pkg: pass cure context as single value
This cleans up the function signature and makes backwards compatible API changes possible. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -69,12 +69,13 @@ func (e DisallowedTypeflagError) Error() string {
|
||||
}
|
||||
|
||||
// Cure cures the [Artifact], producing a directory located at work.
|
||||
func (a *tarArtifact) Cure(work, temp *check.Absolute, loadData CacheDataFunc) (err error) {
|
||||
func (a *tarArtifact) Cure(c *CureContext) (err error) {
|
||||
temp := c.GetTempDir()
|
||||
var tr io.ReadCloser
|
||||
|
||||
{
|
||||
var data []byte
|
||||
data, err = loadData(a.f)
|
||||
data, err = c.LoadData(a.f)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -209,9 +210,9 @@ func (a *tarArtifact) Cure(work, temp *check.Absolute, loadData CacheDataFunc) (
|
||||
if err = os.Chmod(p.String(), 0700); err != nil {
|
||||
return
|
||||
}
|
||||
err = os.Rename(p.String(), work.String())
|
||||
err = os.Rename(p.String(), c.GetWorkDir().String())
|
||||
} else {
|
||||
err = os.Rename(temp.String(), work.String())
|
||||
err = os.Rename(temp.String(), c.GetWorkDir().String())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user