What is the difference between remove_dir and remove_file, why not remove_path?

3 views
Skip to first unread message

Jacek Bzdak

unread,
Jan 30, 2013, 12:57:51 PM1/30/13
to pr...@googlegroups.com
Differences between the two are subtle and IMO not so important, mainly: 
  • remove_dir will fail if we try to remove file with it, unless we specify recursive, in which case it will remove also files. 
  • remove file will fail to remove dir
It gives some amount of protection against errors in provy files, but basing IMO not much less protection would be given if we had: 

def remove_path(name, sudo, recursive, stdout): 


Diogo Baeder

unread,
Jan 30, 2013, 2:44:06 PM1/30/13
to pr...@googlegroups.com
That's a good question, Jacek. I thought about implementing "remove_path" myself (like I did for "change_path_owner" and "change_path_mode"), but I thought it would be a bit dangerous to do so for removal, because of the recursiveness. What do you think?

Also, what do the other devs think? If we have a consensus of going for "remove_path", instead of having both "remove_file" and "remove_dir", I'm ok with that too. :-)

Cheers!

__________________________
Diogo Baeder
http://diogobaeder.com.br




--
You received this message because you are subscribed to the Google Groups "provy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to provy+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jacek Bzdak

unread,
Jan 30, 2013, 3:36:16 PM1/30/13
to pr...@googlegroups.com
For me it is not such a problem because any harm it should do signifies error in provyfile or role, that should be checked during tests. 

I could go for `remove_file` (no changes), and remove_path that is recursive by default. I guess noone needs to remove empty directories. Albeit i think thay remove_path could be the only choice. 
Reply all
Reply to author
Forward
0 new messages