From 32b2ccda1e211b89c4439209e454e768a802c6de Mon Sep 17 00:00:00 2001 From: Josh Curl Date: Sun, 25 Sep 2016 20:37:55 -0700 Subject: [PATCH] Ignore error creating /var/lib/system-docker if it already exists --- init/init.go | 2 +- tests/nonexistent_state_test.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/nonexistent_state_test.go diff --git a/init/init.go b/init/init.go index 3d07baac..15336c0d 100644 --- a/init/init.go +++ b/init/init.go @@ -191,7 +191,7 @@ func setupSharedRoot(c *config.CloudConfig) (*config.CloudConfig, error) { if isInitrd() { for _, i := range []string{"/mnt", "/media", "/var/lib/system-docker"} { - if err := os.Mkdir(i, 0755); err != nil { + if err := os.MkdirAll(i, 0755); err != nil { return c, err } if err := mount.Mount("tmpfs", i, "tmpfs", "rw"); err != nil { diff --git a/tests/nonexistent_state_test.go b/tests/nonexistent_state_test.go new file mode 100644 index 00000000..4a306b4f --- /dev/null +++ b/tests/nonexistent_state_test.go @@ -0,0 +1,10 @@ +package integration + +import . "gopkg.in/check.v1" + +func (s *QemuSuite) TestNonexistentState(c *C) { + err := s.RunQemu("--no-format", "--append", "rancher.state.dev=LABEL=NONEXISTENT") + c.Assert(err, IsNil) + + s.CheckCall(c, "sudo ros config get rancher.state.dev | grep LABEL=NONEXISTENT") +}