Project

General

Profile

Bug #24202

error in creating tarfile in reconfig_glidein

Added by Dennis Box 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
03/19/2020
Due date:
% Done:

0%

Estimated time:
First Occurred:
Occurs In:
Stakeholders:
Duration:

Description

I just tried to do a reconfig/upgrade on the 3_7_rc1 tagged code and this happened:

[root@fermicloud368 factory]# /usr/sbin/gwms-factory upgrade
Using default factory config file: /etc/gwms-factory/glideinWMS.xml
Traceback (most recent call last):
File "/sbin/reconfig_glidein", line 279, in <module>
main(conf, update_scripts, update_def_cfg, comment=comment)
File "/sbin/reconfig_glidein", line 143, in main
tar_utils.add(util_file_path, arcname=os.path.basename(util_file_path))
File "/usr/lib64/python2.7/tarfile.py", line 1953, in add
self._check("aw")
File "/usr/lib64/python2.7/tarfile.py", line 2390, in check
raise IOError("%s is closed" % self.
_class__.__name__)
IOError: TarFile is closed
Upgrading the factory [FAILED]

Looking at reconfig_glidein about line 133 to where it aborts at line 143 it is clear that there are 2 blocks that try to add the files from tar_file_list to the tarfile. The second time it tries to do it after the tarfile exits the with: block and is closed.
This looks like a code review recommendation that was implemented but not well tested. Fortunately the fix is fairly obvious.

try:
with tarfile.open("tar_utils.tar.gz", "w:gz", dereference=True) as tar_utils:
for util_file in tar_file_list:
util_file_path = os.path.join(cgWConsts.WEB_BASE_DIR, util_file)
tar_utils.add(util_file_path, arcname=os.path.basename(util_file_path))
except tarfile.TarError as te:
print2("Unable to pack the startup file payload. TarError: %s" % str(te))
sys.exit(1)
for util_file in tar_file_list:
util_file_path = os.path.join(cgWConsts.WEB_BASE_DIR, util_file)
tar_utils.add(util_file_path, arcname=os.path.basename(util_file_path))

History

#1 Updated by Dennis Box 2 months ago

  • Assignee changed from Dennis Box to Marco Mambelli
  • Status changed from New to Feedback

see branch v37/w4032. I recommend this go into rc2

#2 Updated by Marco Mambelli 2 months ago

  • Assignee changed from Marco Mambelli to Dennis Box

Did not find v37/w4032. Changes are in v37/24202, OK to merge.
It was my fault. I handled badly a 3-way merge and did not test after it

#3 Updated by Dennis Box about 2 months ago

  • Status changed from Feedback to Resolved

merged to branch_v3_7

#4 Updated by Marco Mambelli about 2 months ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF