Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
feudal
feudalBackend
Commits
0cc4ef92
Commit
0cc4ef92
authored
Jun 05, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lint the code
parent
c0173efa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
12 deletions
+13
-12
django_backend/backend/frontend/urls.py
django_backend/backend/frontend/urls.py
+4
-4
django_backend/backend/models.py
django_backend/backend/models.py
+9
-8
No files found.
django_backend/backend/frontend/urls.py
View file @
0cc4ef92
...
...
@@ -2,8 +2,8 @@ from django.conf.urls import url
from
.
import
views
URLPATTERNS
=
[
url
(
r
'^state
/
'
,
views
.
StateView
.
as_view
()),
url
(
r
'^sshkey
/
'
,
views
.
SSHPublicKeyView
.
as_view
()),
url
(
r
'^deployments
/
'
,
views
.
DeploymentView
.
as_view
()),
url
(
r
'^delete_user
/
'
,
views
.
UserDeletionView
.
as_view
()),
url
(
r
'^state'
,
views
.
StateView
.
as_view
()),
url
(
r
'^sshkey'
,
views
.
SSHPublicKeyView
.
as_view
()),
url
(
r
'^deployments'
,
views
.
DeploymentView
.
as_view
()),
url
(
r
'^delete_user'
,
views
.
UserDeletionView
.
as_view
()),
]
django_backend/backend/models.py
View file @
0cc4ef92
...
...
@@ -3,15 +3,17 @@
import
json
import
logging
import
pika
from
pika.exceptions
import
ConnectionClosed
from
requests.auth
import
HTTPBasicAuth
from
django.contrib.auth.models
import
AbstractUser
,
Group
from
django.core.cache
import
cache
from
django.db
import
models
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django_mysql.models
import
JSONField
from
pika.exceptions
import
ConnectionClosed
import
pika
from
requests.auth
import
HTTPBasicAuth
from
.auth.v1.models
import
OIDCConfig
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
@@ -149,7 +151,6 @@ class RabbitMQInstance(SingletonModel):
)
channel
.
close
()
# PUBLIC API
def
publish_by_service
(
self
,
service
,
msg
):
self
.
_publish
(
...
...
@@ -219,7 +220,7 @@ class User(AbstractUser):
# if the user does not exists
@
classmethod
def
get_user
(
cls
,
userinfo
,
idp
):
if
not
'sub'
in
userinfo
:
if
'sub'
not
in
userinfo
:
raise
Exception
(
'get_user needs a userinfo which contains the users subject'
)
query_result
=
cls
.
objects
.
filter
(
...
...
@@ -705,7 +706,7 @@ class DeploymentTask(models.Model):
return
'[DeploymentTask:{}] {}'
.
format
(
self
,
msg
)
def
publish
(
self
):
#
FIXME
mitigating circular dependencies here
# mitigating circular dependencies here
from
.clientapi.serializers
import
DeploymentTaskSerializer
msg
=
json
.
dumps
(
DeploymentTaskSerializer
(
self
).
data
)
...
...
@@ -723,7 +724,7 @@ class DeploymentTask(models.Model):
if
not
self
.
task_items
.
exists
():
# finished sends its own message
self
.
finished
()
self
.
_
finished
()
else
:
from
.frontend.views
import
user_state_dict
content
=
{
...
...
@@ -735,7 +736,7 @@ class DeploymentTask(models.Model):
)
# maintenance after all task items are done
def
finished
(
self
):
def
_
finished
(
self
):
LOGGER
.
info
(
self
.
msg
(
'done'
))
self
.
delete
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment