Skip to content

Commit 815e7ba

Browse files
Todd-L-Millertimtheisen
authored andcommitted
(SOFTWARE-6113) Don't eval() without a context argument.
1 parent 55d8501 commit 815e7ba

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/htcondorce/info_query.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, ce_ad, catalog_entry):
2323

2424
for cekey in ['OSG_Resource', 'OSG_ResourceGroup', 'OSG_BatchSystems']:
2525
self[cekey] = ce_ad[cekey]
26-
self['grid_resource'] = ce_ad['grid_resource'].eval()
26+
self['grid_resource'] = ce_ad['grid_resource'].eval(ce_ad)
2727

2828
for catkey, catval in catalog_entry.items():
2929
if isinstance(catval, classad.ClassAd):

src/htcondorce/web.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def ad_to_json(ad):
132132
for (key, val) in ad.items():
133133
# Evaluate Condor expressions
134134
if isinstance(val, classad.ExprTree):
135-
val = val.eval()
135+
val = val.eval(ad)
136136
result[key] = val
137137
# Unfortunately, classad.Value.Undefined is of type int,
138138
# and json.dumps() converts it to "2".

src/htcondorce/web_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def get_schedd_statuses(environ={}):
9494
if 'Status' not in ad:
9595
results[ad['Name']] = 'Unknown'
9696
else:
97-
results[ad['Name']] = ad['Status'].eval()
97+
results[ad['Name']] = ad['Status'].eval(ad)
9898

9999
return results
100100

@@ -112,7 +112,7 @@ def ad_to_json(ad):
112112
if classad.ExprTree("%s =?= UNDEFINED" % key).eval(ad):
113113
result[key] = {"_condor_type": "expr", "expr": val_expr.__repr__()}
114114
else:
115-
val = val_expr.eval()
115+
val = val_expr.eval(ad)
116116
if isinstance(val, list) or isinstance(val, dict):
117117
result[key] = {"_condor_type": "expr", "expr": val_expr.__repr__()}
118118
else:

0 commit comments

Comments
 (0)