Commit 745728a3 authored by katharina.berger's avatar katharina.berger

fix

parent ebf7d451
......@@ -3,4 +3,4 @@ from mail_utils import send_mail
from solr_utils import query_solr, update_solr, query_esgf, get_list_of_shards, query_for_facet
from mapfile_utils import run_esgmapfile
from publish_utils import run_esgunpublish
from filesystem_utils import change_permissions_recursive
from filesystem_utils import change_permissions
import os
def change_permissions_recursive(path, dirmode=0o770, filemode=0o660):
for root, dirs, files in os.walk(path, topdown=False):
for dir in [os.path.join(root, d) for d in dirs]:
os.chmod(dir, dirmode)
for file in [os.path.join(root, f) for f in files]:
def change_permissions(path, dirmode=0o770, filemode=0o660):
for _, _, files in os.walk(path):
os.chmod(path, dirmode)
for file in [os.path.join(path, f) for f in files]:
os.chmod(file, filemode)
......@@ -9,7 +9,7 @@ import sys
import os
import re
from pkg_utils import change_permissions_recursive
from pkg_utils import change_permissions
from config import Log, Config
from ESGConfigParser import SectionParser, interpolate
from pyesgf.search import SearchConnection
......@@ -50,7 +50,7 @@ def get_deleted_and_retracted(log,
retracted_list,
deleted_list,
to_unpublish_list,
change_permissions,
change_perm,
recipients=None):
"""
Get a list of all datasets that are on disk but either deleted or retracted in ESGF
......@@ -92,8 +92,8 @@ def get_deleted_and_retracted(log,
if retracted == 'true':
retracted_list.write('%s\n' % root)
if change_permissions:
change_permissions_recursive(root)
if change_perm:
change_permissions(root)
to_unpublish_list.write('%s#%s\n' % (master_id, kv['version'][1:]))
else:
......@@ -116,7 +116,7 @@ def main(argv):
config_dir = '/esg/config/esgcet/'
config_filename = 'replica_check.conf'
output_folder = '/tmp'
change_permissions = False
change_perm = False
for flag, arg in args:
if flag in ['-p', '--project']:
......@@ -130,7 +130,7 @@ def main(argv):
elif flag in ['-o', '--output']:
output_folder = arg
elif flag == '--change-permissions':
change_permissions = True
change_perm = True
if len(lastargs) != 0 and os.path.isdir(lastargs[0]):
path_to_scan = lastargs[0]
......@@ -174,7 +174,7 @@ def main(argv):
retracted_list,
deleted_list,
to_unpublish_list,
change_permissions,
change_perm,
recipients=recipients)
retracted_list.close()
deleted_list.close()
......
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