Skip to content

Commit 9abf987

Browse files
Update vacutils; use URL-keyed pipescache
1 parent 3e4613c commit 9abf987

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# Andrew McNab, University of Manchester.
3-
# Copyright (c) 2013-6. All rights reserved.
3+
# Copyright (c) 2013-9. All rights reserved.
44
#
55
# Redistribution and use in source and binary forms, with or
66
# without modification, are permitted provided that the following
@@ -61,6 +61,7 @@ install: $(INSTALL_FILES)
6161
$(RPM_BUILD_ROOT)/usr/share/man/man5 \
6262
$(RPM_BUILD_ROOT)/usr/share/man/man8 \
6363
$(RPM_BUILD_ROOT)/var/lib/vcycle/tmp \
64+
$(RPM_BUILD_ROOT)/var/lib/vcycle/pipescache \
6465
$(RPM_BUILD_ROOT)/var/lib/vcycle/imagecache \
6566
$(RPM_BUILD_ROOT)/var/lib/vcycle/apel-archive \
6667
$(RPM_BUILD_ROOT)/var/lib/vcycle/apel-outgoing \

shared.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -950,12 +950,10 @@ def _expandVacuumPipe(self, parser, vacuumPipeSectionName, machinetypeNamePrefix
950950
totalTargetShare = 0.0
951951

952952
try:
953-
vacuumPipe = vcycle.vacutils.readPipe(
954-
'/var/lib/vcycle/spaces/' + self.spaceName + '/machinetypes/'
955-
+ machinetypeNamePrefix + '/vacuum.pipe',
956-
vacuumPipeURL,
957-
'vcycle ' + vcycleVersion,
958-
updatePipes = updatePipes)
953+
vacuumPipe = vcycle.vacutils.readPipe('/var/lib/vcycle/pipescache',
954+
vacuumPipeURL,
955+
'vcycle ' + vcycleVersion,
956+
updatePipes = updatePipes)
959957
except Exception as e:
960958
raise VcycleError(vacuumPipeURL + ' given but failed reading/updating the pipe: ' + str(e))
961959

vacutils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## UNMODIFIED VERSIONS ARE COPIED TO THE Vcycle REPO AS NEEDED ##
66
#
77
# Andrew McNab, University of Manchester.
8-
# Copyright (c) 2013-8. All rights reserved.
8+
# Copyright (c) 2013-9. All rights reserved.
99
#
1010
# Redistribution and use in source and binary forms, with or
1111
# without modification, are permitted provided that the following
@@ -117,11 +117,13 @@ def secondsToString(timeStamp):
117117
else:
118118
return '%dd' % (seconds / 86400)
119119

120-
def readPipe(pipeFile, pipeURL, versionString, updatePipes = False):
120+
def readPipe(pipeDir, pipeURL, versionString, updatePipes = False):
121121

122122
# Default value in case not given in file
123123
cacheSeconds = 3600
124124

125+
pipeFile = pipeDir + '/' + urllib.quote(pipeURL, '')
126+
125127
try:
126128
pipeDict = json.load(open(pipeFile, 'r'))
127129
except:

vcycle-cgi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,21 @@ except:
5858
print
5959
sys.exit(0)
6060

61-
if ('SSL_CLIENT_S_DN' not in os.environ) or (os.environ['SSL_CLIENT_S_DN'] != httpsX509dn):
61+
if 'SSL_CLIENT_S_DN' not in os.environ:
62+
print 'Status: 403 Forbidden'
63+
print
64+
sys.exit(0)
65+
66+
if os.environ['SSL_CLIENT_S_DN'][0] == '/':
67+
# Use slash format DN without modification
68+
x509Client = os.environ['SSL_CLIENT_S_DN']
69+
else:
70+
# Convert comma DN format to slashes
71+
x509ClientList = os.environ['SSL_CLIENT_S_DN'].split(',')
72+
x509ClientList.reverse()
73+
x509Client = '/' + '/'.join(x509ClientList)
74+
75+
if x509Client != httpsX509dn:
6276
print 'Status: 403 Forbidden'
6377
print
6478
sys.exit(0)

0 commit comments

Comments
 (0)