From 221a3ab2b527e8a8877427c20820cdc19d7bae42 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 7 Mar 2018 11:17:42 -0500 Subject: Make WriteStringToRundir internal We don't want this in our public API - better to let us control what gets put in container storage and where. Signed-off-by: Matthew Heon Closes: #462 Approved by: baude --- libpod/container_internal.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 6fbaa4546..772eeaa66 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -414,8 +414,8 @@ func (c *Container) cleanupStorage() error { return c.save() } -// WriteStringToRundir copies the provided file to the runtimedir -func (c *Container) WriteStringToRundir(destFile, output string) (string, error) { +// writeStringToRundir copies the provided file to the runtimedir +func (c *Container) writeStringToRundir(destFile, output string) (string, error) { destFileName := filepath.Join(c.state.RunDir, destFile) f, err := os.Create(destFileName) if err != nil { @@ -455,7 +455,7 @@ func (c *Container) generateResolvConf() (string, error) { return "", errors.Wrapf(err, "unable to read %s", resolvPath) } if len(c.config.DNSServer) == 0 && len(c.config.DNSSearch) == 0 && len(c.config.DNSOption) == 0 { - return c.WriteStringToRundir("resolv.conf", fmt.Sprintf("%s", orig)) + return c.writeStringToRundir("resolv.conf", fmt.Sprintf("%s", orig)) } // Read and organize the hosts /etc/resolv.conf @@ -483,7 +483,7 @@ func (c *Container) generateResolvConf() (string, error) { resolv.options = nil resolv.options = append(resolv.options, c.Config().DNSOption...) } - return c.WriteStringToRundir("resolv.conf", resolv.ToString()) + return c.writeStringToRundir("resolv.conf", resolv.ToString()) } // createResolv creates a resolv struct from an input string @@ -546,12 +546,12 @@ func (c *Container) generateHosts() (string, error) { hosts += fmt.Sprintf("%s %s\n", fields[0], fields[1]) } } - return c.WriteStringToRundir("hosts", hosts) + return c.writeStringToRundir("hosts", hosts) } // generateEtcHostname creates a containers /etc/hostname func (c *Container) generateEtcHostname(hostname string) (string, error) { - return c.WriteStringToRundir("hostname", hostname) + return c.writeStringToRundir("hostname", hostname) } // Generate spec for a container -- cgit v1.2.3-54-g00ecf