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

Add support for multiple voms hosts #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

darcato
Copy link

@darcato darcato commented Mar 28, 2024

The hosts are parsed from the vomses files.

@darcato darcato marked this pull request as ready for review April 4, 2024 14:44
@@ -43,6 +44,30 @@ def compare_dates(self, date0, date1):
else:
return 1

def parse_vomses_files(self, vomses_dirs: list = ["/etc/vomses", "~/.glite/vomses"]) -> dict:
Copy link
Member

Choose a reason for hiding this comment

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

a vomses file can either be a directory or a regular file, but I don't know how general you want to make this parsing

Copy link
Author

Choose a reason for hiding this comment

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

I now check whether it's a file or a directory


vomses_files = []
for vomses_dir in vomses_dirs:
if os.path.exists(os.path.expanduser(vomses_dir)):
Copy link
Member

Choose a reason for hiding this comment

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

I would save os.path.expanduser(vomses_dir) in a var and reuse it for the join in the next line

try:
with open(vomses_file) as f:
for line in f:
if not line.startswith("#"):
Copy link
Member

Choose a reason for hiding this comment

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

I would consider a line commented out even if the # is not the first character, although this is the current behavior at least of the C/C++ library

Copy link
Author

Choose a reason for hiding this comment

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

I can split the line at the # character and ignore the part after that, but still consider the first part. Do you agree?

with open(vomses_file) as f:
for line in f:
if not line.startswith("#"):
vo, host, port = line.split()[:3]
Copy link
Member

Choose a reason for hiding this comment

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

Looking at the parsing done in the C/C++ library, the VO name is the last entry in the line; the first is the alias, whatever that means. In fact the last entry is the "version", which should be optional and I don't know what is for.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, I will improve the parsing.

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.

2 participants