Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround PRC different behavior file/dictionary #300

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

qubixes
Copy link
Collaborator

@qubixes qubixes commented Feb 7, 2025

See #299 for the issue. The problem is that the PRC behaves different when supplying the irods environment by file or by arguments. It seems that without the file, the login using the cached password in the .irodsA file doesn't work. This is rather a hack by creating a temporary file from the dictionary, any suggestions for improvement are appreciated.

Fixes #299

@d-w-moore
Copy link

d-w-moore commented Feb 7, 2025

[...]. It seems that without the file, the passwordless login doesn't work.

In version v3.0.0 of PRC I am able to get password-less access for the anonymous user to work without env files. Was the anonymous login what the above is referring to?

Python 3.6.9 (default, Mar 10 2023, 16:46:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import irods.session
>>> anon = irods.session.iRODSSession(host='localhost',port=1247,zone='tempZone',user='anonymous')
<irods.session.iRODSSession object at 0x7f89d4bdd208>
>>> anon.collections.get('/tempZone/home/public')
<iRODSCollection 10009 public>


@qubixes
Copy link
Collaborator Author

qubixes commented Feb 7, 2025

@d-w-moore Thanks for looking into it. I meant logging in, using the cached password in the .irodsA file, sorry for the confusion.

So, it triggers when we are creating an IRodsSession, with password=None, irods_env_file=None in which case it seems to not get te password from the .irodsA file.

@d-w-moore
Copy link

d-w-moore commented Feb 7, 2025

@d-w-moore Thanks for looking into it. I meant logging in, using the cached password in the .irodsA file, sorry for the confusion.

So, it triggers when we are creating an IRodsSession, with password=None, irods_env_file=None in which case it seems to not get te password from the .irodsA file.

I see. Have you tried the irods_authentication_file = <filesystem path to .irodsA> option? Not that I'd necessarily expect it to work, I think that the irods_authentication_file and irods_env_file are meant to be used in tandem.

@maartenschermer
Copy link
Collaborator

Maybe not the ideal solution, but within the scope of iBridges I think this works pretty well.

@d-w-moore
Copy link

Maybe not the ideal solution, but within the scope of iBridges I think this works pretty well.

Glad you found a solution that works for you.

Out of curiosity, referencing #299 , would it have been useful if the irods_env_file parameter could take on the value of a dict object? Like the following:

  iRODSSession( irods_env_file = { "irods_port" : 1247 , ... } , irods_authentication_file = os.path.expanduser ("~/.irods/.irodsA") )

@qubixes
Copy link
Collaborator Author

qubixes commented Feb 10, 2025

@d-w-moore Thanks for looking into it. I meant logging in, using the cached password in the .irodsA file, sorry for the confusion.
So, it triggers when we are creating an IRodsSession, with password=None, irods_env_file=None in which case it seems to not get te password from the .irodsA file.

I see. Have you tried the irods_authentication_file = <filesystem path to .irodsA> option? Not that I'd necessarily expect it to work, I think that the irods_authentication_file and irods_env_file are meant to be used in tandem.

I tried this, but it didn't seem to have an effect on this issue.

@qubixes
Copy link
Collaborator Author

qubixes commented Feb 10, 2025

Maybe not the ideal solution, but within the scope of iBridges I think this works pretty well.

Glad you found a solution that works for you.

Out of curiosity, referencing #299 , would it have been useful if the irods_env_file parameter could take on the value of a dict object? Like the following:

  iRODSSession( irods_env_file = { "irods_port" : 1247 , ... } , irods_authentication_file = os.path.expanduser ("~/.irods/.irodsA") )

Yes, I think that would be a good solution. The only thing would be that the name of the keyword might be a little confusing.

Copy link
Collaborator

@chStaiger chStaiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the workaround! Approved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Session: iRODS env as dict while empty password triggers causes JSON error
4 participants