Skip to content

Commit

Permalink
Drive members with JSON instead of text. #1410
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeit-internet2 committed Mar 7, 2024
1 parent 90f3d3d commit d42f64c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion testbed/members/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PRODUCT := output.json

default: build

MEMBERS := members
MEMBERS := members.json

BUILDER := ./build-addresses
$(PRODUCT): Makefile $(BUILDER) $(MEMBERS)
Expand Down
12 changes: 5 additions & 7 deletions testbed/members/build-addresses
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ import sys

addresses = {}

for line in sys.stdin:
# TODO: Remove excess whitespace and blanks
member = re.sub(r'\s*[#].*$', '', line[:-1])
if not member:
continue
input_data = json.load(sys.stdin)

address, label = re.split(r'\s+', member, maxsplit=1)
for address, data in input_data.items():
if address[0] == '#':
continue

addresses[address] = {
'address': address,
'_meta': {
'display-name': label
'display-name': data.get('label', address)
}
}

Expand Down
10 changes: 0 additions & 10 deletions testbed/members/members

This file was deleted.

16 changes: 16 additions & 0 deletions testbed/members/members.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"#": "perfSONAR Development Testbed Hosts",

"host1.perfsonar.net": {
"label": "First Host"
},
"host2.perfsonar.net": {
"label": "Second Host"
},
"host3.perfsonar.net": {
"label": "Third Host"
},
"host4.perfsonar.net": {
"#": "No label on this one."
}
}

0 comments on commit d42f64c

Please sign in to comment.