nautobot 3.0.0rc1__py3-none-any.whl → 3.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nautobot might be problematic. Click here for more details.
- nautobot/apps/forms.py +8 -0
- nautobot/apps/templatetags.py +231 -0
- nautobot/apps/testing.py +11 -1
- nautobot/apps/ui.py +21 -1
- nautobot/apps/utils.py +26 -1
- nautobot/core/celery/__init__.py +46 -1
- nautobot/core/cli/bootstrap_v3_to_v5.py +185 -44
- nautobot/core/cli/bootstrap_v3_to_v5_changes.yaml +314 -0
- nautobot/core/graphql/generators.py +2 -2
- nautobot/core/jobs/bulk_actions.py +12 -6
- nautobot/core/jobs/cleanup.py +13 -1
- nautobot/core/settings.py +13 -0
- nautobot/core/settings.yaml +22 -0
- nautobot/core/settings_funcs.py +11 -1
- nautobot/core/tables.py +19 -1
- nautobot/core/templates/components/panel/body_wrapper_generic_table.html +1 -1
- nautobot/core/templates/components/panel/header_extra_content_table.html +9 -3
- nautobot/core/templates/generic/object_create.html +1 -1
- nautobot/core/templates/inc/header.html +9 -10
- nautobot/core/templates/login.html +16 -1
- nautobot/core/templates/nautobot_config.py.j2 +14 -1
- nautobot/core/templates/redoc_ui.html +3 -0
- nautobot/core/templatetags/helpers.py +3 -3
- nautobot/core/testing/views.py +3 -1
- nautobot/core/tests/test_graphql.py +13 -0
- nautobot/core/tests/test_jobs.py +118 -0
- nautobot/core/tests/test_views.py +24 -0
- nautobot/core/ui/bulk_buttons.py +2 -3
- nautobot/core/utils/lookup.py +2 -3
- nautobot/core/utils/permissions.py +1 -1
- nautobot/core/views/generic.py +1 -0
- nautobot/core/views/mixins.py +37 -10
- nautobot/core/views/renderers.py +1 -0
- nautobot/core/views/utils.py +3 -3
- nautobot/data_validation/views.py +1 -9
- nautobot/dcim/forms.py +9 -9
- nautobot/dcim/models/devices.py +3 -3
- nautobot/dcim/tables/power.py +3 -0
- nautobot/dcim/templates/dcim/controllermanageddevicegroup_create.html +1 -1
- nautobot/dcim/views.py +30 -44
- nautobot/extras/api/views.py +14 -3
- nautobot/extras/choices.py +3 -0
- nautobot/extras/jobs.py +48 -2
- nautobot/extras/migrations/0132_approval_workflow_seed_data.py +127 -0
- nautobot/extras/models/approvals.py +11 -1
- nautobot/extras/models/models.py +19 -0
- nautobot/extras/models/relationships.py +3 -1
- nautobot/extras/tables.py +35 -18
- nautobot/extras/templates/extras/approval_workflow/approve.html +9 -2
- nautobot/extras/templates/extras/approval_workflow/deny.html +9 -3
- nautobot/extras/templates/extras/approvalworkflowdefinition_update.html +1 -1
- nautobot/extras/templates/extras/customfield_update.html +1 -1
- nautobot/extras/templates/extras/dynamicgroup_update.html +2 -2
- nautobot/extras/templates/extras/inc/approval_buttons_column.html +10 -2
- nautobot/extras/templates/extras/inc/job_tiles.html +2 -2
- nautobot/extras/templates/extras/inc/jobresult.html +1 -1
- nautobot/extras/templates/extras/metadatatype_create.html +1 -1
- nautobot/extras/templates/extras/object_approvalworkflow.html +2 -3
- nautobot/extras/templates/extras/secretsgroup_update.html +1 -1
- nautobot/extras/tests/test_api.py +57 -3
- nautobot/extras/tests/test_customfields_filters.py +84 -4
- nautobot/extras/tests/test_views.py +323 -6
- nautobot/extras/views.py +114 -39
- nautobot/ipam/constants.py +2 -2
- nautobot/ipam/tables.py +7 -6
- nautobot/load_balancers/constants.py +6 -0
- nautobot/load_balancers/migrations/0001_initial.py +14 -3
- nautobot/load_balancers/models.py +5 -4
- nautobot/load_balancers/tables.py +5 -0
- nautobot/project-static/dist/css/nautobot.css +1 -1
- nautobot/project-static/dist/css/nautobot.css.map +1 -1
- nautobot/project-static/dist/js/graphql-libraries.js +1 -1
- nautobot/project-static/dist/js/graphql-libraries.js.map +1 -1
- nautobot/project-static/dist/js/libraries.js +1 -1
- nautobot/project-static/dist/js/libraries.js.LICENSE.txt +38 -2
- nautobot/project-static/dist/js/libraries.js.map +1 -1
- nautobot/project-static/dist/js/nautobot-graphiql.js +1 -1
- nautobot/project-static/dist/js/nautobot-graphiql.js.map +1 -1
- nautobot/project-static/dist/js/nautobot.js +1 -1
- nautobot/project-static/dist/js/nautobot.js.map +1 -1
- nautobot/project-static/img/dark-theme.png +0 -0
- nautobot/project-static/img/light-theme.png +0 -0
- nautobot/project-static/img/system-theme.png +0 -0
- nautobot/project-static/js/forms.js +1 -85
- nautobot/tenancy/tables.py +3 -2
- nautobot/tenancy/views.py +3 -2
- nautobot/ui/package-lock.json +553 -569
- nautobot/ui/package.json +10 -10
- nautobot/ui/src/js/checkbox.js +132 -0
- nautobot/ui/src/js/nautobot.js +6 -0
- nautobot/ui/src/js/select2.js +69 -73
- nautobot/ui/src/js/theme.js +129 -39
- nautobot/ui/src/scss/nautobot.scss +11 -1
- nautobot/vpn/templates/vpn/vpnprofile_create.html +2 -2
- nautobot/wireless/filters.py +15 -1
- nautobot/wireless/tables.py +18 -14
- nautobot/wireless/templates/wireless/wirelessnetwork_create.html +1 -1
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/METADATA +2 -2
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/RECORD +103 -98
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/LICENSE.txt +0 -0
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/NOTICE +0 -0
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/WHEEL +0 -0
- {nautobot-3.0.0rc1.dist-info → nautobot-3.0.1.dist-info}/entry_points.txt +0 -0
nautobot/apps/forms.py
CHANGED
|
@@ -69,6 +69,11 @@ from nautobot.core.forms.widgets import (
|
|
|
69
69
|
TimePicker,
|
|
70
70
|
)
|
|
71
71
|
from nautobot.data_validation.form_mixin import DataValidationModelFormMixin
|
|
72
|
+
from nautobot.dcim.form_mixins import (
|
|
73
|
+
LocatableModelBulkEditFormMixin,
|
|
74
|
+
LocatableModelFilterFormMixin,
|
|
75
|
+
LocatableModelFormMixin,
|
|
76
|
+
)
|
|
72
77
|
from nautobot.extras.forms import (
|
|
73
78
|
CustomFieldModelBulkEditFormMixin,
|
|
74
79
|
CustomFieldModelCSVForm,
|
|
@@ -142,6 +147,9 @@ __all__ = (
|
|
|
142
147
|
"JSONArrayFormField",
|
|
143
148
|
"JSONField",
|
|
144
149
|
"LaxURLField",
|
|
150
|
+
"LocatableModelBulkEditFormMixin",
|
|
151
|
+
"LocatableModelFilterFormMixin",
|
|
152
|
+
"LocatableModelFormMixin",
|
|
145
153
|
"MACAddressField",
|
|
146
154
|
"MultiMatchModelMultipleChoiceField",
|
|
147
155
|
"MultiValueCharField",
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"""Template tags for Nautobot."""
|
|
2
|
+
|
|
3
|
+
from nautobot.core.templatetags.buttons import (
|
|
4
|
+
action_url,
|
|
5
|
+
add_button,
|
|
6
|
+
clone_button,
|
|
7
|
+
consolidate_bulk_action_buttons,
|
|
8
|
+
consolidate_detail_view_action_buttons,
|
|
9
|
+
delete_button,
|
|
10
|
+
edit_button,
|
|
11
|
+
export_button,
|
|
12
|
+
import_button,
|
|
13
|
+
job_export_url,
|
|
14
|
+
job_import_button,
|
|
15
|
+
job_import_url,
|
|
16
|
+
render_tag_attrs,
|
|
17
|
+
)
|
|
18
|
+
from nautobot.core.templatetags.form_helpers import (
|
|
19
|
+
render_custom_fields,
|
|
20
|
+
render_field,
|
|
21
|
+
render_form,
|
|
22
|
+
render_relationships,
|
|
23
|
+
widget_type,
|
|
24
|
+
)
|
|
25
|
+
from nautobot.core.templatetags.helpers import (
|
|
26
|
+
add_html_id,
|
|
27
|
+
as_range,
|
|
28
|
+
badge,
|
|
29
|
+
bettertitle,
|
|
30
|
+
custom_branding_or_static,
|
|
31
|
+
dbm,
|
|
32
|
+
divide,
|
|
33
|
+
django_querystring,
|
|
34
|
+
do_captureas,
|
|
35
|
+
dynamic_group_assignment_modal,
|
|
36
|
+
fgcolor,
|
|
37
|
+
filter_form_drawer,
|
|
38
|
+
format_timezone,
|
|
39
|
+
get_attr,
|
|
40
|
+
get_docs_url,
|
|
41
|
+
get_item,
|
|
42
|
+
has_one_or_more_perms,
|
|
43
|
+
has_perms,
|
|
44
|
+
humanize_speed,
|
|
45
|
+
hyperlinked_email,
|
|
46
|
+
hyperlinked_field,
|
|
47
|
+
hyperlinked_object,
|
|
48
|
+
hyperlinked_object_target_new_tab,
|
|
49
|
+
hyperlinked_object_with_color,
|
|
50
|
+
hyperlinked_phone_number,
|
|
51
|
+
label_list,
|
|
52
|
+
legacy_querystring,
|
|
53
|
+
meta,
|
|
54
|
+
meters_to_feet,
|
|
55
|
+
modal_form_as_dialog,
|
|
56
|
+
percentage,
|
|
57
|
+
placeholder,
|
|
58
|
+
pre_tag,
|
|
59
|
+
queryset_to_pks,
|
|
60
|
+
querystring,
|
|
61
|
+
quote_string,
|
|
62
|
+
render_address,
|
|
63
|
+
render_ancestor_hierarchy,
|
|
64
|
+
render_boolean,
|
|
65
|
+
render_button_class,
|
|
66
|
+
render_content_types,
|
|
67
|
+
render_job_run_link,
|
|
68
|
+
render_json,
|
|
69
|
+
render_m2m,
|
|
70
|
+
render_markdown,
|
|
71
|
+
render_uptime,
|
|
72
|
+
render_yaml,
|
|
73
|
+
saved_view_modal,
|
|
74
|
+
saved_view_title,
|
|
75
|
+
settings_or_config,
|
|
76
|
+
slugify,
|
|
77
|
+
split,
|
|
78
|
+
support_message,
|
|
79
|
+
table_config_button,
|
|
80
|
+
table_config_form,
|
|
81
|
+
tag,
|
|
82
|
+
tree_hierarchy_ui_representation,
|
|
83
|
+
tzoffset,
|
|
84
|
+
utilization_graph,
|
|
85
|
+
utilization_graph_raw_data,
|
|
86
|
+
validated_api_viewname,
|
|
87
|
+
validated_viewname,
|
|
88
|
+
versioned_static,
|
|
89
|
+
viewname,
|
|
90
|
+
)
|
|
91
|
+
from nautobot.core.templatetags.perms import (
|
|
92
|
+
can_add,
|
|
93
|
+
can_change,
|
|
94
|
+
can_delete,
|
|
95
|
+
can_view,
|
|
96
|
+
)
|
|
97
|
+
from nautobot.core.templatetags.ui_framework import (
|
|
98
|
+
render_breadcrumbs,
|
|
99
|
+
render_components,
|
|
100
|
+
render_detail_view_extra_buttons,
|
|
101
|
+
render_tabs_labels,
|
|
102
|
+
render_title,
|
|
103
|
+
)
|
|
104
|
+
from nautobot.extras.templatetags.computed_fields import (
|
|
105
|
+
computed_fields,
|
|
106
|
+
has_computed_fields,
|
|
107
|
+
)
|
|
108
|
+
from nautobot.extras.templatetags.custom_links import (
|
|
109
|
+
custom_links,
|
|
110
|
+
)
|
|
111
|
+
from nautobot.extras.templatetags.job_buttons import (
|
|
112
|
+
job_buttons,
|
|
113
|
+
)
|
|
114
|
+
from nautobot.extras.templatetags.log_levels import (
|
|
115
|
+
log_level,
|
|
116
|
+
)
|
|
117
|
+
from nautobot.extras.templatetags.plugins import (
|
|
118
|
+
plugin_banners,
|
|
119
|
+
plugin_buttons,
|
|
120
|
+
plugin_full_width_page,
|
|
121
|
+
plugin_left_page,
|
|
122
|
+
plugin_object_detail_tab_content,
|
|
123
|
+
plugin_object_detail_tabs,
|
|
124
|
+
plugin_right_page,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
__all__ = (
|
|
128
|
+
"action_url",
|
|
129
|
+
"add_button",
|
|
130
|
+
"add_html_id",
|
|
131
|
+
"as_range",
|
|
132
|
+
"badge",
|
|
133
|
+
"bettertitle",
|
|
134
|
+
"can_add",
|
|
135
|
+
"can_change",
|
|
136
|
+
"can_delete",
|
|
137
|
+
"can_view",
|
|
138
|
+
"clone_button",
|
|
139
|
+
"computed_fields",
|
|
140
|
+
"consolidate_bulk_action_buttons",
|
|
141
|
+
"consolidate_detail_view_action_buttons",
|
|
142
|
+
"custom_branding_or_static",
|
|
143
|
+
"custom_links",
|
|
144
|
+
"dbm",
|
|
145
|
+
"delete_button",
|
|
146
|
+
"divide",
|
|
147
|
+
"django_querystring",
|
|
148
|
+
"do_captureas",
|
|
149
|
+
"dynamic_group_assignment_modal",
|
|
150
|
+
"edit_button",
|
|
151
|
+
"export_button",
|
|
152
|
+
"fgcolor",
|
|
153
|
+
"filter_form_drawer",
|
|
154
|
+
"format_timezone",
|
|
155
|
+
"get_attr",
|
|
156
|
+
"get_docs_url",
|
|
157
|
+
"get_item",
|
|
158
|
+
"has_computed_fields",
|
|
159
|
+
"has_one_or_more_perms",
|
|
160
|
+
"has_perms",
|
|
161
|
+
"humanize_speed",
|
|
162
|
+
"hyperlinked_email",
|
|
163
|
+
"hyperlinked_field",
|
|
164
|
+
"hyperlinked_object",
|
|
165
|
+
"hyperlinked_object_target_new_tab",
|
|
166
|
+
"hyperlinked_object_with_color",
|
|
167
|
+
"hyperlinked_phone_number",
|
|
168
|
+
"import_button",
|
|
169
|
+
"job_buttons",
|
|
170
|
+
"job_export_url",
|
|
171
|
+
"job_import_button",
|
|
172
|
+
"job_import_url",
|
|
173
|
+
"label_list",
|
|
174
|
+
"legacy_querystring",
|
|
175
|
+
"log_level",
|
|
176
|
+
"meta",
|
|
177
|
+
"meters_to_feet",
|
|
178
|
+
"modal_form_as_dialog",
|
|
179
|
+
"percentage",
|
|
180
|
+
"placeholder",
|
|
181
|
+
"plugin_banners",
|
|
182
|
+
"plugin_buttons",
|
|
183
|
+
"plugin_full_width_page",
|
|
184
|
+
"plugin_left_page",
|
|
185
|
+
"plugin_object_detail_tab_content",
|
|
186
|
+
"plugin_object_detail_tabs",
|
|
187
|
+
"plugin_right_page",
|
|
188
|
+
"pre_tag",
|
|
189
|
+
"queryset_to_pks",
|
|
190
|
+
"querystring",
|
|
191
|
+
"quote_string",
|
|
192
|
+
"render_address",
|
|
193
|
+
"render_ancestor_hierarchy",
|
|
194
|
+
"render_boolean",
|
|
195
|
+
"render_breadcrumbs",
|
|
196
|
+
"render_button_class",
|
|
197
|
+
"render_components",
|
|
198
|
+
"render_content_types",
|
|
199
|
+
"render_custom_fields",
|
|
200
|
+
"render_detail_view_extra_buttons",
|
|
201
|
+
"render_field",
|
|
202
|
+
"render_form",
|
|
203
|
+
"render_job_run_link",
|
|
204
|
+
"render_json",
|
|
205
|
+
"render_m2m",
|
|
206
|
+
"render_markdown",
|
|
207
|
+
"render_relationships",
|
|
208
|
+
"render_tabs_labels",
|
|
209
|
+
"render_tag_attrs",
|
|
210
|
+
"render_title",
|
|
211
|
+
"render_uptime",
|
|
212
|
+
"render_yaml",
|
|
213
|
+
"saved_view_modal",
|
|
214
|
+
"saved_view_title",
|
|
215
|
+
"settings_or_config",
|
|
216
|
+
"slugify",
|
|
217
|
+
"split",
|
|
218
|
+
"support_message",
|
|
219
|
+
"table_config_button",
|
|
220
|
+
"table_config_form",
|
|
221
|
+
"tag",
|
|
222
|
+
"tree_hierarchy_ui_representation",
|
|
223
|
+
"tzoffset",
|
|
224
|
+
"utilization_graph",
|
|
225
|
+
"utilization_graph_raw_data",
|
|
226
|
+
"validated_api_viewname",
|
|
227
|
+
"validated_viewname",
|
|
228
|
+
"versioned_static",
|
|
229
|
+
"viewname",
|
|
230
|
+
"widget_type",
|
|
231
|
+
)
|
nautobot/apps/testing.py
CHANGED
|
@@ -9,7 +9,13 @@ from nautobot.core.testing import (
|
|
|
9
9
|
from nautobot.core.testing.api import APITestCase, APITransactionTestCase, APIViewTestCases
|
|
10
10
|
from nautobot.core.testing.filters import FilterTestCases
|
|
11
11
|
from nautobot.core.testing.forms import FormTestCases
|
|
12
|
-
from nautobot.core.testing.integration import
|
|
12
|
+
from nautobot.core.testing.integration import (
|
|
13
|
+
BulkOperationsMixin,
|
|
14
|
+
BulkOperationsTestCases,
|
|
15
|
+
ObjectDetailsMixin,
|
|
16
|
+
ObjectsListMixin,
|
|
17
|
+
SeleniumTestCase,
|
|
18
|
+
)
|
|
13
19
|
from nautobot.core.testing.migrations import NautobotDataMigrationTest
|
|
14
20
|
from nautobot.core.testing.mixins import NautobotTestCaseMixin, NautobotTestClient
|
|
15
21
|
from nautobot.core.testing.models import ModelTestCases
|
|
@@ -29,6 +35,8 @@ __all__ = (
|
|
|
29
35
|
"APITestCase",
|
|
30
36
|
"APITransactionTestCase",
|
|
31
37
|
"APIViewTestCases",
|
|
38
|
+
"BulkOperationsMixin",
|
|
39
|
+
"BulkOperationsTestCases",
|
|
32
40
|
"FilterTestCases",
|
|
33
41
|
"FormTestCases",
|
|
34
42
|
"ModelTestCase",
|
|
@@ -37,6 +45,8 @@ __all__ = (
|
|
|
37
45
|
"NautobotDataMigrationTest",
|
|
38
46
|
"NautobotTestCaseMixin",
|
|
39
47
|
"NautobotTestClient",
|
|
48
|
+
"ObjectDetailsMixin",
|
|
49
|
+
"ObjectsListMixin",
|
|
40
50
|
"OpenAPISchemaTestCases",
|
|
41
51
|
"SeleniumTestCase",
|
|
42
52
|
"TestCase",
|
nautobot/apps/ui.py
CHANGED
|
@@ -13,6 +13,13 @@ from nautobot.core.ui.breadcrumbs import (
|
|
|
13
13
|
ModelBreadcrumbItem,
|
|
14
14
|
ViewNameBreadcrumbItem,
|
|
15
15
|
)
|
|
16
|
+
from nautobot.core.ui.bulk_buttons import (
|
|
17
|
+
BaseBulkButton,
|
|
18
|
+
BulkDeleteButton,
|
|
19
|
+
BulkDisconnectButton,
|
|
20
|
+
BulkEditButton,
|
|
21
|
+
BulkRenameButton,
|
|
22
|
+
)
|
|
16
23
|
from nautobot.core.ui.choices import (
|
|
17
24
|
EChartsThemeColors,
|
|
18
25
|
EChartsTypeChoices,
|
|
@@ -49,6 +56,7 @@ from nautobot.core.ui.object_detail import (
|
|
|
49
56
|
DistinctViewTab,
|
|
50
57
|
DropdownButton,
|
|
51
58
|
EChartsPanel,
|
|
59
|
+
FormButton,
|
|
52
60
|
GroupedKeyValueTablePanel,
|
|
53
61
|
KeyValueTablePanel,
|
|
54
62
|
ObjectDetailContent,
|
|
@@ -61,7 +69,11 @@ from nautobot.core.ui.object_detail import (
|
|
|
61
69
|
TextPanel,
|
|
62
70
|
)
|
|
63
71
|
from nautobot.core.ui.titles import Titles
|
|
64
|
-
from nautobot.core.ui.utils import
|
|
72
|
+
from nautobot.core.ui.utils import (
|
|
73
|
+
flatten_context,
|
|
74
|
+
get_absolute_url,
|
|
75
|
+
render_component_template,
|
|
76
|
+
)
|
|
65
77
|
from nautobot.extras.choices import BannerClassChoices
|
|
66
78
|
from nautobot.extras.plugins import Banner, TemplateExtension
|
|
67
79
|
|
|
@@ -71,8 +83,13 @@ __all__ = (
|
|
|
71
83
|
"Banner",
|
|
72
84
|
"BannerClassChoices",
|
|
73
85
|
"BaseBreadcrumbItem",
|
|
86
|
+
"BaseBulkButton",
|
|
74
87
|
"BaseTextPanel",
|
|
75
88
|
"Breadcrumbs",
|
|
89
|
+
"BulkDeleteButton",
|
|
90
|
+
"BulkDisconnectButton",
|
|
91
|
+
"BulkEditButton",
|
|
92
|
+
"BulkRenameButton",
|
|
76
93
|
"Button",
|
|
77
94
|
"ButtonColorChoices",
|
|
78
95
|
"Component",
|
|
@@ -83,6 +100,7 @@ __all__ = (
|
|
|
83
100
|
"EChartsPanel",
|
|
84
101
|
"EChartsThemeColors",
|
|
85
102
|
"EChartsTypeChoices",
|
|
103
|
+
"FormButton",
|
|
86
104
|
"GroupedKeyValueTablePanel",
|
|
87
105
|
"HomePageBase",
|
|
88
106
|
"HomePageGroup",
|
|
@@ -116,6 +134,8 @@ __all__ = (
|
|
|
116
134
|
"Titles",
|
|
117
135
|
"ViewNameBreadcrumbItem",
|
|
118
136
|
"context_object_attr",
|
|
137
|
+
"flatten_context",
|
|
138
|
+
"get_absolute_url",
|
|
119
139
|
"queryset_to_nested_dict_keys_as_series",
|
|
120
140
|
"queryset_to_nested_dict_records_as_series",
|
|
121
141
|
"render_component_template",
|
nautobot/apps/utils.py
CHANGED
|
@@ -16,7 +16,12 @@ from nautobot.core.utils.data import (
|
|
|
16
16
|
to_meters,
|
|
17
17
|
validate_jinja2,
|
|
18
18
|
)
|
|
19
|
-
from nautobot.core.utils.deprecation import
|
|
19
|
+
from nautobot.core.utils.deprecation import (
|
|
20
|
+
class_deprecated,
|
|
21
|
+
class_deprecated_in_favor_of,
|
|
22
|
+
method_deprecated,
|
|
23
|
+
method_deprecated_in_favor_of,
|
|
24
|
+
)
|
|
20
25
|
from nautobot.core.utils.filtering import (
|
|
21
26
|
build_lookup_label,
|
|
22
27
|
get_all_lookup_expr_for_field,
|
|
@@ -29,14 +34,17 @@ from nautobot.core.utils.logging import sanitize
|
|
|
29
34
|
from nautobot.core.utils.lookup import (
|
|
30
35
|
get_breadcrumbs_for_model,
|
|
31
36
|
get_changes_for_model,
|
|
37
|
+
get_created_and_last_updated_usernames_for_model,
|
|
32
38
|
get_detail_view_components_context_for_model,
|
|
33
39
|
get_filterset_for_model,
|
|
34
40
|
get_form_for_model,
|
|
41
|
+
get_model_for_view_name,
|
|
35
42
|
get_model_from_name,
|
|
36
43
|
get_object_detail_content_for_model,
|
|
37
44
|
get_related_class_for_model,
|
|
38
45
|
get_related_field_for_models,
|
|
39
46
|
get_route_for_model,
|
|
47
|
+
get_table_class_string_from_view_name,
|
|
40
48
|
get_table_for_model,
|
|
41
49
|
get_url_for_url_pattern,
|
|
42
50
|
get_url_patterns,
|
|
@@ -47,10 +55,17 @@ from nautobot.core.utils.migrations import migrate_content_type_references_to_ne
|
|
|
47
55
|
from nautobot.core.utils.permissions import (
|
|
48
56
|
get_permission_for_model,
|
|
49
57
|
permission_is_exempt,
|
|
58
|
+
qs_filter_from_constraints,
|
|
50
59
|
resolve_permission,
|
|
51
60
|
resolve_permission_ct,
|
|
52
61
|
)
|
|
62
|
+
from nautobot.core.utils.querysets import (
|
|
63
|
+
maybe_prefetch_related,
|
|
64
|
+
maybe_select_related,
|
|
65
|
+
)
|
|
53
66
|
from nautobot.core.utils.requests import (
|
|
67
|
+
add_nautobot_version_query_param_to_url,
|
|
68
|
+
convert_querydict_to_dict,
|
|
54
69
|
convert_querydict_to_factory_formset_acceptable_querydict,
|
|
55
70
|
ensure_content_type_and_field_name_in_query_params,
|
|
56
71
|
get_filterable_params_from_filter_params,
|
|
@@ -85,12 +100,14 @@ __all__ = (
|
|
|
85
100
|
"GitRepo",
|
|
86
101
|
"RoleModelsQuery",
|
|
87
102
|
"TaggableClassesQuery",
|
|
103
|
+
"add_nautobot_version_query_param_to_url",
|
|
88
104
|
"build_lookup_label",
|
|
89
105
|
"check_if_key_is_graphql_safe",
|
|
90
106
|
"class_deprecated",
|
|
91
107
|
"class_deprecated_in_favor_of",
|
|
92
108
|
"construct_cache_key",
|
|
93
109
|
"convert_git_diff_log_to_list",
|
|
110
|
+
"convert_querydict_to_dict",
|
|
94
111
|
"convert_querydict_to_factory_formset_acceptable_querydict",
|
|
95
112
|
"deepmerge",
|
|
96
113
|
"ensure_content_type_and_field_name_in_query_params",
|
|
@@ -104,6 +121,7 @@ __all__ = (
|
|
|
104
121
|
"get_breadcrumbs_for_model",
|
|
105
122
|
"get_celery_queues",
|
|
106
123
|
"get_changes_for_model",
|
|
124
|
+
"get_created_and_last_updated_usernames_for_model",
|
|
107
125
|
"get_detail_view_components_context_for_model",
|
|
108
126
|
"get_filter_field_label",
|
|
109
127
|
"get_filterable_params_from_filter_params",
|
|
@@ -112,6 +130,7 @@ __all__ = (
|
|
|
112
130
|
"get_filterset_parameter_form_field",
|
|
113
131
|
"get_form_for_model",
|
|
114
132
|
"get_latest_release",
|
|
133
|
+
"get_model_for_view_name",
|
|
115
134
|
"get_model_from_name",
|
|
116
135
|
"get_object_detail_content_for_model",
|
|
117
136
|
"get_permission_for_model",
|
|
@@ -119,6 +138,7 @@ __all__ = (
|
|
|
119
138
|
"get_related_field_for_models",
|
|
120
139
|
"get_route_for_model",
|
|
121
140
|
"get_settings_or_config",
|
|
141
|
+
"get_table_class_string_from_view_name",
|
|
122
142
|
"get_table_for_model",
|
|
123
143
|
"get_url_for_url_pattern",
|
|
124
144
|
"get_url_patterns",
|
|
@@ -131,12 +151,17 @@ __all__ = (
|
|
|
131
151
|
"is_url",
|
|
132
152
|
"is_uuid",
|
|
133
153
|
"lighten_color",
|
|
154
|
+
"maybe_prefetch_related",
|
|
155
|
+
"maybe_select_related",
|
|
134
156
|
"merge_dicts_without_collision",
|
|
157
|
+
"method_deprecated",
|
|
158
|
+
"method_deprecated_in_favor_of",
|
|
135
159
|
"migrate_content_type_references_to_new_model",
|
|
136
160
|
"migrate_role_data",
|
|
137
161
|
"normalize_querydict",
|
|
138
162
|
"permission_is_exempt",
|
|
139
163
|
"populate_model_features_registry",
|
|
164
|
+
"qs_filter_from_constraints",
|
|
140
165
|
"refresh_job_model_from_job_class",
|
|
141
166
|
"remove_prefix_from_cf_key",
|
|
142
167
|
"render_jinja2",
|
nautobot/core/celery/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ from pathlib import Path
|
|
|
5
5
|
import shutil
|
|
6
6
|
import sys
|
|
7
7
|
|
|
8
|
-
from celery import Celery, shared_task, signals
|
|
8
|
+
from celery import bootsteps, Celery, shared_task, signals
|
|
9
9
|
from celery.app.log import TaskFormatter
|
|
10
10
|
from celery.utils.log import get_logger
|
|
11
11
|
from django.apps import apps
|
|
@@ -268,3 +268,48 @@ def register_jobs(*jobs):
|
|
|
268
268
|
for job in jobs:
|
|
269
269
|
if job.class_path not in registry["jobs"]:
|
|
270
270
|
registry["jobs"][job.class_path] = job
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@signals.worker_ready.connect
|
|
274
|
+
def worker_ready(**_):
|
|
275
|
+
if not settings.CELERY_HEALTH_PROBES_AS_FILES:
|
|
276
|
+
return
|
|
277
|
+
WORKER_READINESS_FILE = Path(settings.CELERY_WORKER_READINESS_FILE)
|
|
278
|
+
WORKER_READINESS_FILE.touch(exist_ok=True)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
@signals.worker_shutdown.connect
|
|
282
|
+
def worker_shutdown(**_):
|
|
283
|
+
if not settings.CELERY_HEALTH_PROBES_AS_FILES:
|
|
284
|
+
return
|
|
285
|
+
WORKER_READINESS_FILE = Path(settings.CELERY_WORKER_READINESS_FILE)
|
|
286
|
+
WORKER_READINESS_FILE.unlink(missing_ok=True)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
class LivenessProbe(bootsteps.StartStopStep):
|
|
290
|
+
requires = {"celery.worker.components:Timer"}
|
|
291
|
+
|
|
292
|
+
def __init__(self, parent, **kwargs):
|
|
293
|
+
self.requests = []
|
|
294
|
+
self.tref = None
|
|
295
|
+
self.WORKER_HEARTBEAT_FILE = Path(settings.CELERY_WORKER_HEARTBEAT_FILE)
|
|
296
|
+
|
|
297
|
+
def start(self, parent):
|
|
298
|
+
if not settings.CELERY_HEALTH_PROBES_AS_FILES:
|
|
299
|
+
return
|
|
300
|
+
# This is a 1-second interval.
|
|
301
|
+
self.tref = parent.timer.call_repeatedly(
|
|
302
|
+
1.0,
|
|
303
|
+
self.update_worker_heartbeat_file,
|
|
304
|
+
(parent,),
|
|
305
|
+
priority=10,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
def stop(self, parent):
|
|
309
|
+
self.WORKER_HEARTBEAT_FILE.unlink(missing_ok=True)
|
|
310
|
+
|
|
311
|
+
def update_worker_heartbeat_file(self, parent):
|
|
312
|
+
self.WORKER_HEARTBEAT_FILE.touch(exist_ok=True)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
app.steps["worker"].add(LivenessProbe)
|