save resource after metadata is copied
@@ -71,7 +71,6 @@ class Command(BaseCommand):
# set CoreMetaData object for the composite resource
core_meta_obj = CoreMetaData.objects.create()
comp_res.content_object = core_meta_obj
- comp_res.save()
# migrate raster resource core metadata elements to composite resource
migrate_core_meta_elements(ras_metadata_obj, comp_res)
@@ -132,6 +131,7 @@ class Command(BaseCommand):
logger.info(msg)
# set resource to dirty so that resource level xml files (resource map and
# metadata xml files) will be re-generated as part of next bag download
+ comp_res.save()
try:
set_dirty_bag_flag(comp_res)
except Exception as ex:
