10
10
11
11
SCRIPT = os .path .basename (__file__ )
12
12
ENDPOINT = "https://registry-test.cilogon.org/registry/"
13
+ OSG_CO_ID = 8
13
14
14
15
15
16
_usage = f"""\
16
17
usage: [PASS=...] { SCRIPT } [OPTIONS]
17
18
18
19
OPTIONS:
19
20
-u USER[:PASS] specify USER and optionally PASS on command line
21
+ -c OSG_CO_ID specify OSG CO ID (default = { OSG_CO_ID } )
20
22
-d passfd specify open fd to read PASS
21
23
-f passfile specify path to file to open and read PASS
22
24
-e ENDPOINT specify REST endpoint
@@ -42,6 +44,7 @@ def usage(msg=None):
42
44
class Options :
43
45
endpoint = ENDPOINT
44
46
user = "co_8.project_script"
47
+ osg_co_id = OSG_CO_ID
45
48
outfile = None
46
49
authstr = None
47
50
@@ -87,8 +90,7 @@ def call_api(target, **kw):
87
90
88
91
89
92
def get_osg_co_groups ():
90
- OSG_CO_ID = 8
91
- return call_api ("co_groups.json" , coid = OSG_CO_ID )
93
+ return call_api ("co_groups.json" , coid = options .osg_co_id )
92
94
93
95
94
96
# primary api calls
@@ -149,7 +151,7 @@ def get_co_person_osguser(pid):
149
151
150
152
def parse_options (args ):
151
153
try :
152
- ops , args = getopt .getopt (args , 'u:d:f:e:o:h' )
154
+ ops , args = getopt .getopt (args , 'u:c: d:f:e:o:h' )
153
155
except getopt .GetoptError :
154
156
usage ()
155
157
@@ -162,6 +164,7 @@ def parse_options(args):
162
164
for op , arg in ops :
163
165
if op == '-h' : usage ()
164
166
if op == '-u' : options .user = arg
167
+ if op == '-c' : options .osg_co_id = int (arg )
165
168
if op == '-d' : passfd = int (arg )
166
169
if op == '-f' : passfile = arg
167
170
if op == '-e' : options .endpoint = arg
0 commit comments