@@ -18,18 +18,24 @@ def verify(args,config,eos,db):
18
18
19
19
import pwd
20
20
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" )
26
23
args .shares_owner = ''
24
+ eos_project_path = os .path .join (config ['eos_project_prefix' ],args .project_name [0 ],args .project_name )
27
25
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 '-' " )
31
29
return
32
30
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
+
33
39
if args .logdir :
34
40
import logging
35
41
fix_str = ""
@@ -99,6 +105,12 @@ def verify(args,config,eos,db):
99
105
if args .fix :
100
106
db .set_orphan (s .id )
101
107
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
+
102
114
except subprocess .CalledProcessError ,x :
103
115
if x .returncode == 2 :
104
116
# eos entry does not exist
@@ -223,7 +235,7 @@ def verify(args,config,eos,db):
223
235
return
224
236
225
237
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
227
239
eos_to_check = cernbox_utils .eos .EOS (get_eos_server (args .project_name , 'project' ))
228
240
229
241
elif args .homedir :
@@ -295,19 +307,20 @@ def is_blacklisted(path):
295
307
cnt_skipped += 1
296
308
continue
297
309
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
-
302
310
p = os .path .normpath (file )
303
311
304
312
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" ),
306
314
eos .AclEntry (entity = "egroup" ,name = 'cernbox-project-%s-readers' % args .project_name , bits = "rx" )]
307
315
308
316
309
317
if p .startswith (os .path .join (homedir ,'www' )):
310
318
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
311
324
312
325
p += "/" # add trailing slash to directories, this will make sure that the top-of-shared-directory-tree also matches
313
326
0 commit comments