- if policy in ('all', 'safe'):
- redo = True
- else:
- redo = not hierarchy.auth_exists(record.hrn)
- if not redo:
- print("IGN (existing) {}".format(record.hrn))
- else:
+ if record.type == 'authority':
+ if policy in ('all', 'safe'):
+ redo = True
+ else:
+ redo = not hierarchy.auth_exists(record.hrn)
+ if not redo:
+ print("IGN (existing) {}".format(record.hrn))
+ else:
+ print("NEW {} {}".format(record.type, record.hrn))
+ # because we have it sorted we should not need create_parents
+ gid = hierarchy.create_auth(str(record.hrn))
+ record.gid = gid
+ count_auths += 1
+ ########## slices
+ if record.type == 'slice':
+ hrn = str(record.hrn)
+ gid = record.get_gid_object()
+ uuid = gid.get_uuid()
+ pub = gid.get_pubkey()
+ print("pub {} uuid {}...".format(pub, str(uuid)[:6]))
+ new_gid = hierarchy.create_gid(hrn, uuid, pub)
+ new_gid_str = new_gid.save_to_string()
+ record.gid = new_gid_str