How to detect a python overwrite file?

9 views
Skip to first unread message

Bruno Santos

unread,
Dec 12, 2025, 8:35:42 AM (4 days ago) Dec 12
to iRODS-Chat

For context: we want to control the data_object overwrite and only allow it when some cases.


In the case of icommands: iput and icp (I still need to check others icommands), it was straightforward: in the peps pep_api_data_obj_put_pre and pep_api_data_obj_copy_pre, check for param 'forceFlag' and if present verify the desired conditions.


When it comes to the python client, the peps that need to be looked at are pep_api_data_obj_open_pre and pep_api_data_obj_write_pre. But by analyzing the available data in these peps, I’m not able to find the force flag information.

Question 1: Is the force flag info available in these peps?

 

The best I was able to get was in the pep_resource_resolve_hierarchy_pre with:

```

if api_index == '602': # DATA_OBJ_OPEN_AN

    if rule_args[3] == 'CREATE':

        # put new file

    elif rule_args[3] == 'WRITE':

        # put overwrite file

```

Question 2: Are the assumptions in the pep_resource_resolve_hierarchy_pre to find a file overwrite correct? Are they safe to use?

 

Also, I made some tests with the python client and found that: it is on the client side that verification of the overwrite flag is performed, so that when the force flag is False and the file already exists, the requests is not sent to the server.

Question 3: Is the force flag check done on the client side?

Question 3.1: If yes, can we assume that all the requests to pep_api_data_obj_open_pre are always force flag by default ?

 


Regards,

Bruno

Reply all
Reply to author
Forward
0 new messages