mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-24 14:32:33 +00:00
k8s:kbs: Add trap statement to clean up tmp files
This PR adds the trap statement in the confidential kbs script to clean up temporary files and ensure we are leaving them. Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
This commit is contained in:
parent
8412c09143
commit
973b8a1d8f
@ -85,12 +85,13 @@ kbs_set_resource_base64() {
|
||||
fi
|
||||
|
||||
file=$(mktemp -t kbs-resource-XXXXX)
|
||||
trap "rm -f $file" EXIT
|
||||
|
||||
echo "$data" | base64 -d > "$file"
|
||||
|
||||
kbs_set_resource_from_file "$repository" "$type" "$tag" "$file" || \
|
||||
rc=$?
|
||||
|
||||
rm -f "$file"
|
||||
return $rc
|
||||
}
|
||||
|
||||
@ -116,12 +117,12 @@ kbs_set_resource() {
|
||||
fi
|
||||
|
||||
file=$(mktemp -t kbs-resource-XXXXX)
|
||||
trap "rm -f $file" EXIT
|
||||
echo "$data" > "$file"
|
||||
|
||||
kbs_set_resource_from_file "$repository" "$type" "$tag" "$file" || \
|
||||
rc=$?
|
||||
|
||||
rm -f "$file"
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user