Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
0cc4ef92
Commit
0cc4ef92
authored
Jun 05, 2018
by
Lukas Burgey
Browse files
Lint the code
parent
c0173efa
Changes
2
Show whitespace changes
Inline
Side-by-side
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