Skip to content

Commit 816c48f

Browse files
committed
Tar creation fixed.
1 parent 7f11758 commit 816c48f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/magentoimagecleanup.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def parse(self):
4141
parser.add_argument('-v', '--verbose', action='store_true', default=False)
4242
parser.add_argument('--force-host', metavar='HOST', help="force this host")
4343
parser.add_argument('--image-archive', metavar='IMAGEARCHIVE',
44-
help='Tar archive for images')
44+
help='Archive for images')
4545
parser.add_argument('magentoPath', metavar='MAGENTOPATH',
4646
help='base path of magento')
4747
args = parser.parse_args()
@@ -111,7 +111,7 @@ def notFound(self):
111111
print value
112112

113113
def createImageArchive(self, images):
114-
tar = tarfile.open(self.imageArchive, 'w:gz')
114+
archive = tarfile.open(self.imageArchive, 'w:gz')
115115
counters = {}
116116
for imagePath, productId in images.items():
117117
try:
@@ -123,10 +123,12 @@ def createImageArchive(self, images):
123123
img = os.path.join(self.magentoPath, self.MEDIA_PRODUCT, imagePath[1:])
124124
info.size = os.path.getsize(img)
125125
info.mtime = os.path.getmtime(img)
126+
info.gid = 1000
127+
info.uid = 1000
126128
with open(img, 'r') as fileobj:
127-
tar.addfile(tarinfo=info, fileobj=fileobj)
128-
tar.addfile(info)
129+
archive.addfile(tarinfo=info, fileobj=fileobj)
129130
self.log.debug('add %s to archive', imagePath)
131+
archive.close()
130132
self.log.info('%s successfully created', self.imageArchive)
131133

132134
def run(self):

0 commit comments

Comments
 (0)