Skip to content

Commit

Permalink
More Py2.4-compatible try..finally/except blocks
Browse files Browse the repository at this point in the history
Needed for SLC5 compatibility. Python <= 2.4 does not support except and
finally in the same block, they must be split into two try blocks.

See https://docs.python.org/2/whatsnew/2.5.html#pep-341
  • Loading branch information
Dario Berzano committed Jun 18, 2014
1 parent 0609ea4 commit 9c16791
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions cernvm/amiconfig/plugins/cernvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,26 @@ def configure(self):
# Write configuration
f = None
try:
f = open('/etc/cvmfs/config.d/%s.conf'%r_name, 'w')
f.write( 'CVMFS_SERVER_URL=http://%s/cvmfs/%s\n' % (r_serv, r_name) )
f.write( 'CVMFS_HTTP_PROXY=DIRECT\n' )
except IOError, e:
print "Cannot write configuration for CVMFS repo %s" % r_name
pass
try:
f = open('/etc/cvmfs/config.d/%s.conf'%r_name, 'w')
f.write( 'CVMFS_SERVER_URL=http://%s/cvmfs/%s\n' % (r_serv, r_name) )
f.write( 'CVMFS_HTTP_PROXY=DIRECT\n' )
except IOError, e:
print "Cannot write configuration for CVMFS repo %s" % r_name
pass
finally:
if f is not None: f.close()

# Write key
f = None
try:
f = open('/etc/cvmfs/keys/%s.pub'%r_name, 'w')
f.write(r_key)
f.write('\n')
except IOError, e:
print "Cannot write pubkey for CVMFS repo %s" % r_name
pass
try:
f = open('/etc/cvmfs/keys/%s.pub'%r_name, 'w')
f.write(r_key)
f.write('\n')
except IOError, e:
print "Cannot write pubkey for CVMFS repo %s" % r_name
pass
finally:
if f is not None: f.close()

Expand Down

0 comments on commit 9c16791

Please sign in to comment.