Commit Graph

13331 Commits

Author SHA1 Message Date
Jeremy Stretch
7d02a37e9b #7025: Misc cleanup 2024-07-30 13:50:42 -04:00
Alexander Haase
faf67b3437 15692: Introduce background jobs (#16927)
* Introduce reusable BackgroundJob framework

A new abstract class can be used to implement job function classes. It
handles the necessary logic for starting and stopping jobs, including
exception handling and rescheduling of recurring jobs.

This commit also includes the migration of data source jobs to the new
framework.

* Restore using import_string for jobs

Using the 'import_string()' utility from Django allows the job script
class to be simplified, as module imports no longer need to avoid loops.
This should make it easier to queue and maintain jobs.

* Use SyncDataSourceJob for management command

Instead of maintaining two separate job execution logics, the same job
is now used for both background and interactive execution.

* Implement BackgroundJob for running scripts

The independent implementations of interactive and background script
execution have been merged into a single BackgroundJob implementation.

* Fix documentation of model features

* Ensure consitent code style

* Introduce reusable ScheduledJob

A new abstract class can be used to implement job function classes that
specialize in scheduling. These use the same logic as regular
BackgroundJobs, but ensure that they are only scheduled once at any given
time.

* Introduce reusable SystemJob

A new abstract class can be used to implement job function classes that
specialize in system background tasks (e.g. synchronization or
housekeeping). In addition to the features of the BackgroundJob and
ScheduledJob classes, these implement additional logic to not need to be
bound to an existing NetBox object and to setup job schedules on plugin
load instead of an interactive request.

* Add documentation for jobs framework

* Revert "Use SyncDataSourceJob for management"

This partially reverts commit db591d4. The 'run_now' parameter of
'enqueue()' remains, as its being used by following commits.

* Merge enqueued status into JobStatusChoices

* Fix logger for ScriptJob

* Remove job name for scripts

Because scripts are already linked through the Job Instance field, the
name is displayed twice. Removing this reduces redundancy and opens up
the possibility of simplifying the BackgroundJob framework in future
commits.

* Merge ScheduledJob into BackgroundJob

Instead of using separate classes, the logic of ScheduledJob is now
merged into the generic BackgroundJob class. This allows reusing the
same logic, but dynamically deciding whether to enqueue the same job
once or multiple times.

* Add name attribute for BackgroundJob

Instead of defining individual names on enqueue, BackgroundJob classes
can now set a job name in their meta class. This is equivalent to other
Django classes and NetBox scripts.

* Drop enqueue_sync_job() method from DataSource

* Import ScriptJob directly

* Relax requirement for Jobs to reference a specific object

* Rename 'run_now' arg on Job.enqueue() to 'immediate'

* Fix queue lookup in Job enqueue

* Collapse SystemJob into BackgroundJob

* Remove legacy JobResultStatusChoices

ChoiceSet was moved to core in 6a8ffd9.

* Use queue 'low' for system jobs by default

System jobs usually perform low-priority background tasks and therefore
can use a different queue than 'default', which is used for regular jobs
related to specific objects.

* Add test cases for BackgroundJob handling

* Fix enqueue interval jobs

As the job's name is set by enqueue(), it must not be passed in handle()
to avoid duplicate kwargs with the same name.

* Honor schedule_at for job's enqueue_once

Not only can a job's interval change, but so can the time at which it is
scheduled to run. If a specific scheduled time is set, it will also be
checked against the current job schedule. If there are any changes, the
job is rescheduled with the new time.

* Switch BackgroundJob to regular methods

Instead of using a class method for run(), a regular method is used for
this purpose. This gives the possibility to add more convenience methods
in the future, e.g. for interacting with the job object or for logging,
as implemented for scripts.

* Fix background tasks documentation

* Test enqueue in combination with enqueue_once

* Rename background jobs to tasks (to differentiate from RQ)

* Touch up docs

* Revert "Use queue 'low' for system jobs by default"

This reverts commit b17b2050df.

* Remove system background job

This commit reverts commits 4880d81 and 0b15ecf. Using the database
'connection_created' signal for job registration feels a little wrong at
this point, as it would trigger registration very often. However, the
background job framework is prepared for this use case and can be used
by plugins once the auto-registration of jobs is solved.

* Fix runscript management command

Defining names for background jobs was disabled with fb75389. The
preceeding changes in 257976d did forget the management command.

* Use regular imports for ScriptJob

* Rename BackgroundJob to JobRunner

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-30 13:31:21 -04:00
Jeremy Stretch
dcb73687c7 Flesh out v4.1 changelog 2024-07-29 20:58:29 -04:00
samk-acw
a3dd5f8e4d Fixes #16782: Add object filtering for custom fields (#16994)
* Fixes #16782: Add object filtering for custom fields

* Add validation for related_object_filter

* Extend documentation & misc cleanup

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-29 15:45:48 -04:00
github-actions
4b98458d8b Update source translation strings 2024-07-27 05:02:14 +00:00
Jeremy Stretch
c0319de7c6 Merge branch 'develop' into feature 2024-07-26 16:39:58 -04:00
Jeremy Stretch
4c1e2788a4 PRVB 2024-07-26 16:25:32 -04:00
Jeremy Stretch
0b472126aa Merge branch 'master' into develop 2024-07-26 16:24:55 -04:00
Jeremy Stretch
f065d561c1 Update static assets 2024-07-26 16:20:46 -04:00
Jeremy Stretch
d622017f25 Release v4.0.8 2024-07-26 16:20:46 -04:00
Jeremy Stretch
16c3b69daa Update import statements for Strawberry 0.236.0 2024-07-26 16:20:46 -04:00
transifex-integration[bot]
b4a1dd3029 Updates for project NetBox (#17004)
* Translate django.po in de

100% translated source file: 'django.po'
on 'de'.

* Translate django.po in pt

100% translated source file: 'django.po'
on 'pt'.

* Translate django.po in zh

100% translated source file: 'django.po'
on 'zh'.

* Translate django.po in pl

100% translated source file: 'django.po'
on 'pl'.

* Translate django.po in ja

100% translated source file: 'django.po'
on 'ja'.

* Translate django.po in nl

100% translated source file: 'django.po'
on 'nl'.

* Translate django.po in cs

100% translated source file: 'django.po'
on 'cs'.

* Translate django.po in uk

100% translated source file: 'django.po'
on 'uk'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-07-26 16:20:46 -04:00
Jonathan Senecal
f034e4ee5a Use provider_id instead of account_id in url_params 2024-07-26 16:20:46 -04:00
Jeremy Stretch
24da421af4 Changelog for #16933, #16943, #16964 2024-07-26 16:20:46 -04:00
Jeremy Stretch
07861df1b0 Fixes #16964: Ensure configured password validators are enforced (#16990)
* Closes #16964: Validate password when creating a new user or updating password for an existing user

* Add serializer validation & tests

---------

Co-authored-by: Nishant Gaglani <nishantgaglani@gmail.com>
2024-07-26 16:20:46 -04:00
Jeremy Stretch
be2df141d1 Remove jeffgdotorg from triage rotation 2024-07-26 16:20:46 -04:00
github-actions
a12efb8d60 Update source translation strings 2024-07-26 16:20:46 -04:00
Jeremy Stretch
7b5cf14dba Closes #16933: Enable toggling true/false marks on BooleanColumn 2024-07-26 16:20:46 -04:00
Jeremy Stretch
9e9452d56c Closes #16943: Expand navigation breadcrumbs on job view to include parent object 2024-07-26 16:20:46 -04:00
github-actions
275c6af866 Update source translation strings 2024-07-26 16:20:46 -04:00
Jeremy Stretch
fc1af5b5f4 Closes #16929: Add version & user details as data attributes (#16939)
* Closes #16929: Add version & user details as data attributes

* Fix typo
2024-07-26 16:20:46 -04:00
Benjamin Dale
cc57c38b94 Update CONTRIBUTING.md
The GitHub reactions icon has been moved from the top right to the bottom left of messages in Issues - I was going insane trying to find it, so this might help someone in the future ; )
2024-07-26 16:20:46 -04:00
Jeremy Stretch
ccdf36989c Changelog for #16402, #16536, #16624, #16819 2024-07-26 16:20:46 -04:00
Arthur Hanson
0518444c8f 16819 highlight parent device in rack (#16881)
* 16819 highlight parent device in rack

* 16819 review changes
2024-07-26 16:20:46 -04:00
Eric Oswald
1b31eb3fa2 Fix incorrect import in rest-api.md 2024-07-26 16:20:46 -04:00
Thomas Fargeix
c9d316b8fa Fixes 16536 - Fix filtering of device component by device role (#16553)
* Fixes 16536 - Fix filtering of device component by device role

Rename role and role_id fields to device_role and device_role_id in
DeviceComponentFilterSet

* Update tests for DeviceComponentFilterSet

* Use device_role filter name for DeviceComponentFilterSetTests

* Add test_device_role test in InventoryItemTestCase
2024-07-26 16:20:46 -04:00
Fabian Geisberger
b234c316aa Fixes #16624: Set allow_null=True on method fields that can return None 2024-07-26 16:20:46 -04:00
Arthur Hanson
0ba8d22948 16402 remove links from script result table 2024-07-26 16:20:46 -04:00
github-actions
da2998b52c Update source translation strings 2024-07-26 16:20:46 -04:00
Jeremy Stretch
275644b53e Changelog for #14640, #14792, #15660, #15696, #16793 2024-07-26 16:20:46 -04:00
transifex-integration[bot]
372a59d67f Updates for project NetBox (#16888)
* Translate django.po in pt

100% reviewed source file: 'django.po'
on 'pt'.

* Translate django.po in es

100% translated source file: 'django.po'
on 'es'.

* Translate django.po in de

100% translated source file: 'django.po'
on 'de'.

* Translate django.po in fr

100% translated source file: 'django.po'
on 'fr'.

* Translate django.po in ru

100% translated source file: 'django.po'
on 'ru'.

* Translate django.po in ja

100% translated source file: 'django.po'
on 'ja'.

* Translate django.po in it

100% translated source file: 'django.po'
on 'it'.

* Translate django.po in cs

100% translated source file: 'django.po'
on 'cs'.

* Translate django.po in zh

100% translated source file: 'django.po'
on 'zh'.

* Translate django.po in nl

100% translated source file: 'django.po'
on 'nl'.

* Translate django.po in da

100% translated source file: 'django.po'
on 'da'.

* Translate django.po in uk

100% translated source file: 'django.po'
on 'uk'.

* Translate django.po in pl

100% translated source file: 'django.po'
on 'pl'.

* Translate django.po in tr

100% translated source file: 'django.po'
on 'tr'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-07-26 16:20:46 -04:00
Jeff Gehlbach
668b032ec4 Added CS, DA, IT, NL, and PL, minus the .po and .mo starting point files (#16810)
* Added CS, DA, IT, NL, and PL, minus the .po and .mo starting point files

* Add initial PO files for new languages

* Revert updates to EN django.po

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-26 16:20:46 -04:00
github-actions
0136ecccc5 Update source translation strings 2024-07-26 16:20:46 -04:00
Jeremy Stretch
1dd236bd34 Changelog for #15375, #16357, #16760, #16838, #16867 2024-07-26 16:20:46 -04:00
Jeremy Stretch
b7b881c629 Update contact email 2024-07-26 16:20:46 -04:00
the.friendly.net
7c992a3b55 Fixes #16760: datasource git on local file system fails (#16872)
* Fixes #16760: datasource git on local file system fails

* Fixes #16760: datasource git on local file system fails

* Set depth & quiet parameters only if using a remote URL

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-26 16:20:46 -04:00
Jeff Gehlbach
bf6d7d1c05 Small additions and tweaks to release checklist from releasing v4.0.7 2024-07-26 16:20:46 -04:00
Arthur Hanson
cc43cb6ef3 16838 show extra_buttons if no actions defined 2024-07-26 16:20:46 -04:00
Arthur Hanson
5162179a27 16867 render dashboard if model no longer available 2024-07-26 16:20:46 -04:00
Arthur Hanson
bd13e316c4 16357 clone tenant and type for cable 2024-07-26 16:20:46 -04:00
Théophile Bastian
d20b88cf8e SSO: custom name for identity providers (#16732) 2024-07-26 16:20:46 -04:00
github-actions
4f43cd1572 Update source translation strings 2024-07-26 16:20:46 -04:00
Jeremy Stretch
ce8d94e785 PRVB 2024-07-26 16:20:46 -04:00
Jeremy Stretch
83748e8213 Update static assets 2024-07-26 15:47:57 -04:00
Jeremy Stretch
22cdc6ddb2 Release v4.0.8 2024-07-26 15:37:05 -04:00
Jeremy Stretch
4fa33034c7 Update import statements for Strawberry 0.236.0 2024-07-26 15:35:08 -04:00
transifex-integration[bot]
801221e07a Updates for project NetBox (#17004)
* Translate django.po in de

100% translated source file: 'django.po'
on 'de'.

* Translate django.po in pt

100% translated source file: 'django.po'
on 'pt'.

* Translate django.po in zh

100% translated source file: 'django.po'
on 'zh'.

* Translate django.po in pl

100% translated source file: 'django.po'
on 'pl'.

* Translate django.po in ja

100% translated source file: 'django.po'
on 'ja'.

* Translate django.po in nl

100% translated source file: 'django.po'
on 'nl'.

* Translate django.po in cs

100% translated source file: 'django.po'
on 'cs'.

* Translate django.po in uk

100% translated source file: 'django.po'
on 'uk'.

---------

Co-authored-by: transifex-integration[bot] <43880903+transifex-integration[bot]@users.noreply.github.com>
2024-07-26 15:34:47 -04:00
Jonathan Senecal
fb819005e1 Use provider_id instead of account_id in url_params 2024-07-26 15:10:25 -04:00
Arthur Hanson
ef84275939 16992 remove TODO for NetBox 4.1 (#16993)
* 16992 remove TODO for NetBox 4.1

* 16992 fix custom validator

* Remove obsolete LegacyScriptRedirectView

---------

Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
2024-07-26 09:46:16 -04:00
Jeremy Stretch
7925287fa4 Changelog for #16933, #16943, #16964 2024-07-26 08:01:08 -04:00