-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: master
Are you sure you want to change the base?
Conversation
lib/VOMSLibrary.py
Outdated
@@ -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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
lib/VOMSLibrary.py
Outdated
|
||
vomses_files = [] | ||
for vomses_dir in vomses_dirs: | ||
if os.path.exists(os.path.expanduser(vomses_dir)): |
There was a problem hiding this comment.
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
lib/VOMSLibrary.py
Outdated
try: | ||
with open(vomses_file) as f: | ||
for line in f: | ||
if not line.startswith("#"): |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
lib/VOMSLibrary.py
Outdated
with open(vomses_file) as f: | ||
for line in f: | ||
if not line.startswith("#"): | ||
vo, host, port = line.split()[:3] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
The hosts are parsed from the vomses files.