Skip to content

Commit afd1398

Browse files
committed
add a lot more verbose output to show new identifier (SOFTWARE-5058)
1 parent 66e2bc3 commit afd1398

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

create_project.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ def get_co_group(gid):
144144
return grouplist[0]
145145

146146

147+
def get_identifier(id_):
148+
idfs = call_api("identifiers/%s.json" % id_) | get_datalist("Identifiers")
149+
if not idfs:
150+
raise RuntimeError("No such Identifier Id: %s" % id_)
151+
return idfs[0]
152+
153+
147154
# @rorable
148155
# def foo(x): ...
149156
# x | foo -> foo(x)
@@ -236,10 +243,26 @@ def main(args):
236243

237244
if options.gname:
238245
options.gid = gname_to_gid(options.gname)
246+
else:
247+
options.gname = get_co_group(options.gid)["Name"]
248+
249+
print('Creating new Identifier for project "%s"\n'
250+
'for CO Group "%s" (%s)'
251+
% (options.project, options.gname, options.gid))
252+
print("")
253+
254+
resp = add_project_identifier_to_group(options.gid, options.project)
255+
256+
print("Server Response:")
257+
print(json.dumps(resp, indent=2, sort_keys=True))
239258

240-
add_project_identifier_to_group(options.gid, options.project)
259+
new_identifier = get_identifier(resp["Id"])
260+
print("")
261+
print("New Identifier Object:")
262+
print(json.dumps(new_identifier, indent=2, sort_keys=True))
241263

242264
# no exceptions, must have worked
265+
print("")
243266
print(":thumbsup:")
244267

245268

0 commit comments

Comments
 (0)