nautobot-app-golden-config
nautobot-app-golden-config copied to clipboard
updated safer migration
Tests are failing. Saying validated_save Attribute doesn't exist on DGs.
@glennmatthews I think the failure is from how I am interacting with the DynamicGroup model. I have always been told to not reference model code in migrations as it is dependent on that code not changing in later releases.
Oh right. In a migration you get a very bare-bones proxy of the model :-( https://docs.djangoproject.com/en/3.2/topics/migrations/#historical-models. So this approach won't work. You could call .clean()
and .save()
directly but that won't actually get into the real model's clean method even so, so I think this fix is DOA.
Is there a post migration signal we can do or better to wrap in a management command?
@glennmatthews & @itdependsnetworks thoughts on adding this to the plugin config? https://docs.djangoproject.com/en/3.2/ref/signals/#post-migrate
Thought would be to query all the DGs and perform a validated_save() on them and if it fails we error out and provide output that informs the user to fix the specific DG?
https://nautobot.readthedocs.io/en/stable/plugins/development/#populating-extensibility-features is essentially this. :-)
@whitej6 what should we do here?
@itdependsnetworks I need to swap the updated migrations to what Glenn linked.
@glennmatthews can you take a peak?