Compare commits

...

2 Commits
0.2.7 ... 0.2.9

Author SHA1 Message Date
f76432f60a Add use of template to Install command
The template name wasnt used, so the command gave an error saying
that no template was used.

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-12-29 11:28:16 +00:00
38f26b213f Clear snapshot when container doesn't exist
This clears up a scenario where a container can be deleted but
its snapshot is not.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-12-28 20:01:01 +00:00
3 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/faasd /faasd
hosts hosts
/resolv.conf /resolv.conf
.idea/

View File

@ -43,6 +43,12 @@ func Remove(ctx context.Context, client *containerd.Client, name string) error {
if err != nil { if err != nil {
return fmt.Errorf("error deleting container %s, %s, %s", container.ID(), name, err) return fmt.Errorf("error deleting container %s, %s, %s", container.ID(), name, err)
} }
} else {
service := client.SnapshotService("")
key := name + "snapshot"
if _, err := client.SnapshotService("").Stat(ctx, key); err == nil {
service.Remove(ctx, key)
}
} }
return nil return nil
} }

View File

@ -66,7 +66,7 @@ func DaemonReload() error {
func InstallUnit(name string) error { func InstallUnit(name string) error {
tmplName := "./hack/" + name + ".service" tmplName := "./hack/" + name + ".service"
tmpl, err := template.ParseFiles() tmpl, err := template.ParseFiles(tmplName)
if err != nil { if err != nil {
return fmt.Errorf("error loading template %s, error %s", tmplName, err) return fmt.Errorf("error loading template %s, error %s", tmplName, err)