@@ -18,18 +18,24 @@ def verify(args,config,eos,db):
1818
1919 import pwd
2020
21- if not args .shares_owner .strip ():
22- logger .critical ("Must provide a shares_owner or '-'" )
23- return
24-
25- if args .shares_owner == '-' :
21+ if args .project_name :
22+ logger .info ("Analysing an entire project (and all shares). Skipping shares_owner" )
2623 args .shares_owner = ''
24+ eos_project_path = os .path .join (config ['eos_project_prefix' ],args .project_name [0 ],args .project_name )
2725
28- if args . deep_fs_check :
29- if not args .shares_owner :
30- logger .critical ("Must provide a single shares_owner for --deep-fs-check option " )
26+ else :
27+ if not args .shares_owner . strip () :
28+ logger .critical ("Must provide a shares_owner or '-' " )
3129 return
3230
31+ if args .shares_owner == '-' :
32+ args .shares_owner = ''
33+
34+ if args .deep_fs_check :
35+ if not args .shares_owner :
36+ logger .critical ("Must provide a single shares_owner for --deep-fs-check option" )
37+ return
38+
3339 if args .logdir :
3440 import logging
3541 fix_str = ""
@@ -99,6 +105,12 @@ def verify(args,config,eos,db):
99105 if args .fix :
100106 db .set_orphan (s .id )
101107 continue
108+
109+ if args .project_name :
110+ if not f .file .startsWith (eos_project_path ):
111+ logger .info ("NOT_PROJECT_SHARE id=%d owner=%s sharee=%s target='%s' fid=%s, skipping" ,s .id ,s .uid_owner ,s .share_with ,s .file_target ,fid )
112+ continue
113+
102114 except subprocess .CalledProcessError ,x :
103115 if x .returncode == 2 :
104116 # eos entry does not exist
@@ -223,7 +235,7 @@ def verify(args,config,eos,db):
223235 return
224236
225237 if args .project_name :
226- homedir = os . path . join ( config [ 'eos_project_prefix' ], args . project_name [ 0 ], args . project_name )
238+ homedir = eos_project_path
227239 eos_to_check = cernbox_utils .eos .EOS (get_eos_server (args .project_name , 'project' ))
228240
229241 elif args .homedir :
@@ -295,19 +307,20 @@ def is_blacklisted(path):
295307 cnt_skipped += 1
296308 continue
297309
298- # expected ACL
299- uid = str (pwd .getpwnam (args .shares_owner ).pw_uid )
300- expected_acls = [eos .AclEntry (entity = "u" ,name = uid ,bits = "rwx" )] # this acl entry should be always set for every directory in homedir
301-
302310 p = os .path .normpath (file )
303311
304312 if args .project_name :
305- expected_acls + = [eos .AclEntry (entity = "egroup" ,name = 'cernbox-project-%s-writers' % args .project_name , bits = "rwx+d" ),
313+ expected_acls = [eos .AclEntry (entity = "egroup" ,name = 'cernbox-project-%s-writers' % args .project_name , bits = "rwx+d" ),
306314 eos .AclEntry (entity = "egroup" ,name = 'cernbox-project-%s-readers' % args .project_name , bits = "rx" )]
307315
308316
309317 if p .startswith (os .path .join (homedir ,'www' )):
310318 expected_acls += [eos .AclEntry (entity = "u" ,name = '83367' ,bits = 'rx' )] # uid wwweos
319+
320+ else :
321+ # expected ACL
322+ uid = str (pwd .getpwnam (args .shares_owner ).pw_uid )
323+ expected_acls = [eos .AclEntry (entity = "u" ,name = uid ,bits = "rwx" )] # this acl entry should be always set for every directory in homedir
311324
312325 p += "/" # add trailing slash to directories, this will make sure that the top-of-shared-directory-tree also matches
313326
0 commit comments