Commit 6f593817 authored by katharina.berger's avatar katharina.berger

fix find_retracted

parent 745728a3
......@@ -65,7 +65,7 @@ def get_deleted_and_retracted(log,
# check permissions, check only if not already set to "770"
st = os.stat(root)
permissions_other = oct(st.st_mode)[-1]
if permissions_other < 4:
if int(permissions_other) < 4:
continue
kv = {}
......@@ -80,13 +80,13 @@ def get_deleted_and_retracted(log,
kv[key] = res.group(key)
kv['version'] = os.path.basename(os.path.dirname(ffp))
if kv['institution_id'] not in EXCLUDE_INSTITUTES:
master_id = interpolate(project_config.get('dataset_id', raw=True), kv)
instance_id = '%s.%s' % (master_id, kv['version'])
master_id = interpolate(project_config.get('dataset_id', raw=True), kv)
instance_id = '%s.%s' % (master_id, kv['version'])
# check SearchAPI for dataset
# check SearchAPI for dataset
ctx = conn.new_context(replica=False, instance_id=instance_id, facets='retracted')
ctx = conn.new_context(replica=False, instance_id=instance_id, facets='retracted')
if ctx.hit_count > 0:
retracted = ctx.facet_counts['retracted'].keys()[0]
if retracted:
if retracted == 'true':
......@@ -94,10 +94,19 @@ def get_deleted_and_retracted(log,
if change_perm:
change_permissions(root)
to_unpublish_list.write('%s#%s\n' % (master_id, kv['version'][1:]))
if kv['institution_id'] not in EXCLUDE_INSTITUTES:
to_unpublish_list.write('%s#%s\n' % (master_id, kv['version'][1:]))
else:
deleted_list.write('%s\n' % root)
if kv['institution_id'] not in EXCLUDE_INSTITUTES:
# cross-check at PCMDI
conn_pcmdi = SearchConnection('http://esgf-node.llnl.gov/esg-search', distrib=True)
ctx = conn_pcmdi.new_context(replica=False, instance_id=instance_id)
if ctx.hit_count == 0:
deleted_list.write('%s\n' % root)
if kv['institution_id'] not in EXCLUDE_INSTITUTES:
to_unpublish_list.write('%s#%s\n' % (master_id, kv['version'][1:]))
except:
log.info("\tCheck failed for=%s" % ffp)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment