Extras¶
Replace Role Related Models with Generic Role Model¶
- Narrowly defined role models including
dcim.DeviceRole,dcim.RackRoleandipam.Roleare replaced by a genericextras.Rolemodel. - If any of your models are using the replaced role models, it is required for you to remove the
rolefield from your model and add eithernautobot.extras.models.roles.RoleModelMixinornautobot.extras.models.roles.RoleRequiredRoleModelMixinto your model class definition.RoleModelMixinadds a nullablerolefield whereasRoleRequiredRoleModelMixinadds a requiredrolefield. - Please go here to check out how the
extras.Rolemodel works in v2.0.
Updates to Job and Job related models¶
Job Model Changes¶
See details about the fundamental changes to Job Model here
Job Logging Changes¶
- Job logging is now handled by a logger off the Job itself and has a function for each level to send the message (info, warning, debug, etc).
JobResult.logno longer accepts aloggerarg and app/job authors should transition to using the Job's logger methods instead of directly callingJobResult.log.- There is no longer a
log_successorlog_failurefunction. Checkout the changes in detail here
JobResult Model Changes¶
JobResult no longer needs a job_id, user, or obj_type passed to it. It now needs a name, task_name, and a worker. See here for details.
Update CustomField, ComputedField, and Relationship¶
- In accordance with the removal of
slugfield in Nautobot v2.0,CustomField,ComputeFieldandRelationship'sslugfield is replaced by thekeyfield which contains a GraphQL-safe string that is used exclusively in the API and GraphQL. - Removed
namefield fromCustomFieldmodel and renamednamefield tolabelonRelationshipmodel. - Their
labelfields are now used for display purposes only in the UI. - Please go to their respective documentations for more information CustomField, ComputedField, and Relationship.