Skip to content

Commit

Permalink
fix creating db user and other minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Apr 1, 2018
1 parent 6455a84 commit 67bf48b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions deli/counter/auth/drivers/database/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ def create_user(self):
user.password = request.password

session.add(user)
session.commit(user)
session.commit()
session.refresh(user)

return ResponseDatabaseUser.from_database(user)
return ResponseDatabaseUser.from_database(user)

@Route(route='users/{user_id}')
@cherrypy.tools.model_params(cls=ParamsDatabaseUser)
Expand Down
1 change: 0 additions & 1 deletion deli/counter/http/mounts/root/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class RootMount(ApplicationMount):
def __init__(self, app: HTTPApplication):
super().__init__(app=app, mount_point='/')
self.auth_manager: AuthManager = None
self.messaging = None

def validate_token(self):
authorization_header = cherrypy.request.headers.get('Authorization', None)
Expand Down
12 changes: 6 additions & 6 deletions deli/kubernetes/resources/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from kubernetes.client import V1DeleteOptions, V1Namespace
from kubernetes.client.rest import ApiException

from deli.kubernetes.resources.const import NAME_LABEL, MEMBER_LABEL
from deli.kubernetes.resources.const import NAME_LABEL, MEMBER_LABEL, PROJECT_LABEL


class Project(object):
Expand All @@ -19,7 +19,7 @@ def __init__(self, raw=None):
"name": str(uuid.uuid4()),
"labels": {
NAME_LABEL: None,
"sandwichcloud.com/project": "true"
PROJECT_LABEL: "true"
}
}
}
Expand Down Expand Up @@ -53,7 +53,7 @@ def get(cls, id, safe=True):
return None
if resp['metadata']['labels'] is None:
return None
if 'sandwichcloud.com/project' not in resp['metadata']['labels']:
if PROJECT_LABEL not in resp['metadata']['labels']:
return None
except ApiException as e:
if e.status == 404 and safe:
Expand All @@ -73,11 +73,11 @@ def list(cls, **kwargs):
if 'label_selector' in kwargs:
label_selector = kwargs['label_selector']
if len(label_selector) > 0:
kwargs['label_selector'] += ",sandwichcloud.com/project"
kwargs['label_selector'] += "," + PROJECT_LABEL
else:
kwargs['label_selector'] += "sandwichcloud.com/project"
kwargs['label_selector'] += PROJECT_LABEL
else:
kwargs['label_selector'] = "sandwichcloud.com/project"
kwargs['label_selector'] = PROJECT_LABEL
core_api = client.CoreV1Api()
raw_list = core_api.list_namespace(**kwargs)
items = []
Expand Down
2 changes: 1 addition & 1 deletion deli/menu/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def setup_arguments(self, parser):

def run(self, args) -> int:

if args.out_of_band is not None:
if hasattr(args, "out_of_band"):
self.logger.info("Using out of band configuration for metadata")
if os.path.isdir(args.out_of_band) is False:
self.logger.error("Could not find directory for out of band configuration " + args.out_of_band)
Expand Down

0 comments on commit 67bf48b

Please sign in to comment.