mirror of https://github.com/containers/podman.git
				
				
				
			Do not report that /usr/share/containers/storage.conf has been edited.
Only want to report if user created local customized storage in /etc/containers/storage.conf or in $HOME/.config/containers/storage.conf, when resetting storage. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
		
							parent
							
								
									a263069568
								
							
						
					
					
						commit
						9003cdbf62
					
				
							
								
								
									
										2
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										2
									
								
								go.mod
								
								
								
								
							|  | @ -11,7 +11,7 @@ require ( | ||||||
| 	github.com/container-orchestrated-devices/container-device-interface v0.5.2 | 	github.com/container-orchestrated-devices/container-device-interface v0.5.2 | ||||||
| 	github.com/containernetworking/cni v1.1.2 | 	github.com/containernetworking/cni v1.1.2 | ||||||
| 	github.com/containernetworking/plugins v1.1.1 | 	github.com/containernetworking/plugins v1.1.1 | ||||||
| 	github.com/containers/buildah v1.28.1-0.20221028091010-9f7a94f34a74 | 	github.com/containers/buildah v1.28.1-0.20221029151733-c2cf9fa47ab6 | ||||||
| 	github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3 | 	github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3 | ||||||
| 	github.com/containers/conmon v2.0.20+incompatible | 	github.com/containers/conmon v2.0.20+incompatible | ||||||
| 	github.com/containers/image/v5 v5.23.1-0.20221027111947-5f02f763c564 | 	github.com/containers/image/v5 v5.23.1-0.20221027111947-5f02f763c564 | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										4
									
								
								go.sum
								
								
								
								
							|  | @ -260,8 +260,8 @@ github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHV | ||||||
| github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= | github.com/containernetworking/plugins v0.9.1/go.mod h1:xP/idU2ldlzN6m4p5LmGiwRDjeJr6FLK6vuiUwoH7P8= | ||||||
| github.com/containernetworking/plugins v1.1.1 h1:+AGfFigZ5TiQH00vhR8qPeSatj53eNGz0C1d3wVYlHE= | github.com/containernetworking/plugins v1.1.1 h1:+AGfFigZ5TiQH00vhR8qPeSatj53eNGz0C1d3wVYlHE= | ||||||
| github.com/containernetworking/plugins v1.1.1/go.mod h1:Sr5TH/eBsGLXK/h71HeLfX19sZPp3ry5uHSkI4LPxV8= | github.com/containernetworking/plugins v1.1.1/go.mod h1:Sr5TH/eBsGLXK/h71HeLfX19sZPp3ry5uHSkI4LPxV8= | ||||||
| github.com/containers/buildah v1.28.1-0.20221028091010-9f7a94f34a74 h1:LxNRZ4M/gEnDT4Guu4KqlTNWSlKyVHRQ4glzlIJUV1U= | github.com/containers/buildah v1.28.1-0.20221029151733-c2cf9fa47ab6 h1:6bFoF3QIUzza8NWAsHS1ZGDDEr+r5do46dXEbzkZb3Y= | ||||||
| github.com/containers/buildah v1.28.1-0.20221028091010-9f7a94f34a74/go.mod h1:skMuWv4FIebpsAFT7fBv2Ll0e0w2j71IUWCIrw9iTV0= | github.com/containers/buildah v1.28.1-0.20221029151733-c2cf9fa47ab6/go.mod h1:skMuWv4FIebpsAFT7fBv2Ll0e0w2j71IUWCIrw9iTV0= | ||||||
| github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3 h1:BxeJsrqor6A6ze52vqCruQLjtklKYbpQgizxjA6D/qY= | github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3 h1:BxeJsrqor6A6ze52vqCruQLjtklKYbpQgizxjA6D/qY= | ||||||
| github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3/go.mod h1:pc6mEke4ejIOQxHD8ag6myKkhIvhcfJ6RV+0UVosuBk= | github.com/containers/common v0.50.2-0.20221027091852-54845c3325e3/go.mod h1:pc6mEke4ejIOQxHD8ag6myKkhIvhcfJ6RV+0UVosuBk= | ||||||
| github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg= | github.com/containers/conmon v2.0.20+incompatible h1:YbCVSFSCqFjjVwHTPINGdMX1F6JXHGTUje2ZYobNrkg= | ||||||
|  |  | ||||||
|  | @ -14,6 +14,7 @@ import ( | ||||||
| 	"github.com/containers/podman/v4/pkg/rootless" | 	"github.com/containers/podman/v4/pkg/rootless" | ||||||
| 	"github.com/containers/podman/v4/pkg/util" | 	"github.com/containers/podman/v4/pkg/util" | ||||||
| 	"github.com/containers/storage" | 	"github.com/containers/storage" | ||||||
|  | 	stypes "github.com/containers/storage/types" | ||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
|  | @ -209,9 +210,14 @@ func (r *Runtime) reset(ctx context.Context) error { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if storageConfPath, err := storage.DefaultConfigFile(rootless.IsRootless()); err == nil { | 	if storageConfPath, err := storage.DefaultConfigFile(rootless.IsRootless()); err == nil { | ||||||
|  | 		switch storageConfPath { | ||||||
|  | 		case stypes.SystemConfigFile: | ||||||
|  | 			break | ||||||
|  | 		default: | ||||||
| 			if _, err = os.Stat(storageConfPath); err == nil { | 			if _, err = os.Stat(storageConfPath); err == nil { | ||||||
| 			fmt.Printf("A storage.conf file exists at %s\n", storageConfPath) | 				fmt.Printf(" A %q config file exists.\n", storageConfPath) | ||||||
| 			fmt.Println("You should remove this file if you did not modify the configuration.") | 				fmt.Println("Remove this file if you did not modify the configuration.") | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		if prevError != nil { | 		if prevError != nil { | ||||||
|  |  | ||||||
|  | @ -254,11 +254,6 @@ skip_if_remote "FIXME FIXME FIXME: find a way to clean up their podman calls" \ | ||||||
|                "bud with run should not leave mounts behind cleanup test" \ |                "bud with run should not leave mounts behind cleanup test" \ | ||||||
|                "bud with custom files in /run/ should persist cleanup test" |                "bud with custom files in /run/ should persist cleanup test" | ||||||
| 
 | 
 | ||||||
| # Under podman-remote, the "Ignoring <stdin>:5:2: error: #error" message |  | ||||||
| # is never seen. (Not even as stdout/stderr on the server; Ed checked). |  | ||||||
| skip_if_remote "FIXME FIXME FIXME: 'Ignoring' warning is never seen" \ |  | ||||||
|                "bud with preprocessor error" |  | ||||||
| 
 |  | ||||||
| # END   tests which are skipped due to actual podman or podman-remote bugs. | # END   tests which are skipped due to actual podman or podman-remote bugs. | ||||||
| ############################################################################### | ############################################################################### | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -69,6 +69,7 @@ var _ = Describe("podman system reset", func() { | ||||||
| 		Expect(session).Should(Exit(0)) | 		Expect(session).Should(Exit(0)) | ||||||
| 
 | 
 | ||||||
| 		Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process"))) | 		Expect(session.ErrorToString()).To(Not(ContainSubstring("Failed to add pause process"))) | ||||||
|  | 		Expect(session.ErrorToString()).To(Not(ContainSubstring("/usr/share/containers/storage.conf"))) | ||||||
| 
 | 
 | ||||||
| 		session = podmanTest.Podman([]string{"images", "-n"}) | 		session = podmanTest.Podman([]string{"images", "-n"}) | ||||||
| 		session.WaitWithDefaultTimeout() | 		session.WaitWithDefaultTimeout() | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ import ( | ||||||
| 
 | 
 | ||||||
| 	"github.com/containers/buildah/util" | 	"github.com/containers/buildah/util" | ||||||
| 	"github.com/containers/image/v5/pkg/compression" | 	"github.com/containers/image/v5/pkg/compression" | ||||||
|  | 	"github.com/containers/storage/pkg/archive" | ||||||
| 	"github.com/containers/storage/pkg/fileutils" | 	"github.com/containers/storage/pkg/fileutils" | ||||||
| 	"github.com/containers/storage/pkg/idtools" | 	"github.com/containers/storage/pkg/idtools" | ||||||
| 	"github.com/containers/storage/pkg/reexec" | 	"github.com/containers/storage/pkg/reexec" | ||||||
|  | @ -1462,6 +1463,10 @@ func copierHandlerGetOne(srcfi os.FileInfo, symlinkTarget, name, contentPath str | ||||||
| 			hdr.Mode = int64(*options.ChmodFiles) | 			hdr.Mode = int64(*options.ChmodFiles) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	// read fflags, if any
 | ||||||
|  | 	if err := archive.ReadFileFlagsToTarHeader(contentPath, hdr); err != nil { | ||||||
|  | 		return fmt.Errorf("getting fflags: %w", err) | ||||||
|  | 	} | ||||||
| 	var f *os.File | 	var f *os.File | ||||||
| 	if hdr.Typeflag == tar.TypeReg { | 	if hdr.Typeflag == tar.TypeReg { | ||||||
| 		// open the file first so that we don't write a header for it if we can't actually read it
 | 		// open the file first so that we don't write a header for it if we can't actually read it
 | ||||||
|  | @ -1889,6 +1894,10 @@ func copierHandlerPut(bulkReader io.Reader, req request, idMappings *idtools.IDM | ||||||
| 			if err = lutimes(hdr.Typeflag == tar.TypeSymlink, path, hdr.AccessTime, hdr.ModTime); err != nil { | 			if err = lutimes(hdr.Typeflag == tar.TypeSymlink, path, hdr.AccessTime, hdr.ModTime); err != nil { | ||||||
| 				return fmt.Errorf("setting access and modify timestamps on %q to %s and %s: %w", path, hdr.AccessTime, hdr.ModTime, err) | 				return fmt.Errorf("setting access and modify timestamps on %q to %s and %s: %w", path, hdr.AccessTime, hdr.ModTime, err) | ||||||
| 			} | 			} | ||||||
|  | 			// set fflags if supported
 | ||||||
|  | 			if err := archive.WriteFileFlagsFromTarHeader(path, hdr); err != nil { | ||||||
|  | 				return fmt.Errorf("copier: put: error setting fflags on %q: %w", path, err) | ||||||
|  | 			} | ||||||
| 		nextHeader: | 		nextHeader: | ||||||
| 			hdr, err = tr.Next() | 			hdr, err = tr.Next() | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -253,10 +253,6 @@ func (b *Builder) Run(command []string, options RunOptions) error { | ||||||
| 		jconf.Set("devfs_ruleset", 4) | 		jconf.Set("devfs_ruleset", 4) | ||||||
| 		jconf.Set("allow.raw_sockets", true) | 		jconf.Set("allow.raw_sockets", true) | ||||||
| 		jconf.Set("allow.chflags", true) | 		jconf.Set("allow.chflags", true) | ||||||
| 		jconf.Set("allow.mount", true) |  | ||||||
| 		jconf.Set("allow.mount.devfs", true) |  | ||||||
| 		jconf.Set("allow.mount.nullfs", true) |  | ||||||
| 		jconf.Set("allow.mount.fdescfs", true) |  | ||||||
| 		jconf.Set("securelevel", -1) | 		jconf.Set("securelevel", -1) | ||||||
| 		netjail, err := jail.Create(jconf) | 		netjail, err := jail.Create(jconf) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
|  |  | ||||||
|  | @ -95,7 +95,7 @@ github.com/containernetworking/cni/pkg/version | ||||||
| # github.com/containernetworking/plugins v1.1.1 | # github.com/containernetworking/plugins v1.1.1 | ||||||
| ## explicit; go 1.17 | ## explicit; go 1.17 | ||||||
| github.com/containernetworking/plugins/pkg/ns | github.com/containernetworking/plugins/pkg/ns | ||||||
| # github.com/containers/buildah v1.28.1-0.20221028091010-9f7a94f34a74 | # github.com/containers/buildah v1.28.1-0.20221029151733-c2cf9fa47ab6 | ||||||
| ## explicit; go 1.17 | ## explicit; go 1.17 | ||||||
| github.com/containers/buildah | github.com/containers/buildah | ||||||
| github.com/containers/buildah/bind | github.com/containers/buildah/bind | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue