+ attr_list = []
+
+ # sort out the initscript... The NM expects to receive an initscript name
+ # and a dictionary of initscripts. NM ends up discarding the initscript
+ # name and sticking the contents in the slice record. (technically, this
+ # is what we started with, but we have to provide the data in the format
+ # that the NM expects)
+ if ticket_attrs.get("initscript", None):
+ initscript_name = ticket_attrs.get("name") + "_initscript"
+ initscript_body = ticket_attrs.get("initscript")
+ data["initscripts"] = {"name": initscript_name, "script": initscript_body}
+ attr_dict["initscript"] = initscript_name
+ else:
+ data["initscripts"] = {}
+
+ # copy the rspec attributes from the geniticket into the plticket
+ # attributes. The NM will later copy them back out and put them into
+ # the rspec field of the slice record
+ for itemname in ticket_rspec.keys():
+ attr = {"name": itemname, "value": ticket_rspec[itemname]}
+ attr_list.append(attr)
+
+ # NM expects to receive a list of key dictionaries containing the
+ # keys.
+ keys = []
+ for key in ticket_attrs.get("keys", []):
+ keys.append({"key": key})
+ rec["keys"] = keys