Skip to content

Commit b07adf7

Browse files
xcp/repository.py: Fixup unclosed file warning left from #27
Fixup the unclosed file warning which was introduced by commit 08f000 (xcp.repository: switch from ConfigParser to configparser) in #27. PS: Because I'm using pre-commit now, also remove a line which had trailing spaces Signed-off-by: Bernhard Kaindl <bernhard.kaindl@cloud.com>
1 parent eb2039d commit b07adf7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xcp/repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def getRepoVer(cls, access):
136136
access.start()
137137
is_yum = YumRepository.isRepo(access, "")
138138
access.finish()
139-
140139
if is_yum:
141140
return YumRepository.getRepoVer(access)
142141
return Repository.getRepoVer(access)
@@ -190,7 +189,8 @@ def _getVersion(cls, access, category):
190189
treeinfofp = io.TextIOWrapper(rawtreeinfofp, encoding='utf-8')
191190
treeinfo = configparser.ConfigParser()
192191
treeinfo.read_file(treeinfofp)
193-
treeinfofp = None
192+
if treeinfofp != rawtreeinfofp:
193+
treeinfofp.close()
194194
rawtreeinfofp.close()
195195
if treeinfo.has_section('system-v1'):
196196
ver_str = treeinfo.get('system-v1', category_map[category])

0 commit comments

Comments
 (0)