From f93043615f31214193c9079d38498028331c72ca Mon Sep 17 00:00:00 2001 From: Brielle Broder Date: Wed, 27 Jun 2018 13:31:46 -0700 Subject: Added MkdirAll capabilities for Checkpoint's image-path. Now able to save the state file (checkpoint.img) at an image-path that had previously not existed. This is important because there can only be one checkpoint.img file per directory so this will enable users to create as many directories as needed for proper organization. PiperOrigin-RevId: 202360414 Change-Id: If5dd2b72e08ab52834a2b605571186d107b64526 --- runsc/cmd/checkpoint.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runsc/cmd/checkpoint.go b/runsc/cmd/checkpoint.go index e5fc7bdc4..a28eb0f02 100644 --- a/runsc/cmd/checkpoint.go +++ b/runsc/cmd/checkpoint.go @@ -81,6 +81,10 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...interfa Fatalf("image-path flag must be provided") } + if err := os.MkdirAll(c.imagePath, 0755); err != nil { + Fatalf("error making directories at path provided: %v", err) + } + fullImagePath := filepath.Join(c.imagePath, checkpointFileName) // Create the image file and open for writing. -- cgit v1.2.3