Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
25923e28
Commit
25923e28
authored
3 years ago
by
Tore.Brede
Browse files
Options
Downloads
Patches
Plain Diff
GREG-7: Adding comment
parent
cf2fd3b6
No related branches found
No related tags found
1 merge request
!18
GREG-7: Simple task running functionality. Adding ask for checking roles about to expire
Pipeline
#89035
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
greg/schedule.py
+7
-3
7 additions, 3 deletions
greg/schedule.py
with
7 additions
and
3 deletions
greg/schedule.py
+
7
−
3
View file @
25923e28
...
...
@@ -46,7 +46,10 @@ class BaseSchedule(ABC):
class
ExpiringRolesNotification
(
BaseSchedule
):
"""
This task does a simple check for roles that will expire in 30 days
and creates entries in the notification table for them
and creates entries in the notification table for them.
There should be an entry in the ScheduleTask-table with name role_expiration
before this task is run.
Some assumptions that are made:
...
...
@@ -66,13 +69,14 @@ class ExpiringRolesNotification(BaseSchedule):
def
_run_internal
(
self
):
last_run
=
self
.
get_last_run
()
# Only run once per day
if
last_run
is
None
or
last_run
.
date
()
!=
date
.
today
():
check_date
=
datetime
.
today
()
+
timedelta
(
days
=
self
.
EXPIRATION_THRESHOLD_DAYS
)
self
.
_get_roles_about_to_expire
(
check_date
)
self
.
_
_
get_roles_about_to_expire
(
check_date
)
def
_get_roles_about_to_expire
(
self
,
end_date
:
date
):
def
_
_get_roles_about_to_expire
(
self
,
end_date
:
date
):
roles_about_to_expire
=
PersonRole
.
objects
.
filter
(
end_date
=
end_date
)
for
person_role
in
roles_about_to_expire
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment