Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
2d7646e7
Commit
2d7646e7
authored
4 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
TMSS-320
: made factory creation method for dbcreds instance
parent
7bb298e6
No related branches found
No related tags found
2 merge requests
!308
Resolve TMSS-495
,
!306
Resolve TMSS-320
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
SAS/TMSS/client/lib/tmss_http_rest_client.py
+9
-1
9 additions, 1 deletion
SAS/TMSS/client/lib/tmss_http_rest_client.py
with
9 additions
and
1 deletion
SAS/TMSS/client/lib/tmss_http_rest_client.py
+
9
−
1
View file @
2d7646e7
...
@@ -7,6 +7,8 @@ import os
...
@@ -7,6 +7,8 @@ import os
import
json
import
json
from
datetime
import
datetime
from
datetime
import
datetime
from
lofar.common.datetimeutils
import
formatDatetime
from
lofar.common.datetimeutils
import
formatDatetime
from
lofar.common.dbcredentials
import
DBCredentials
# usage example:
# usage example:
#
#
...
@@ -43,8 +45,14 @@ class TMSSsession(object):
...
@@ -43,8 +45,14 @@ class TMSSsession(object):
if
dbcreds_name
is
None
:
if
dbcreds_name
is
None
:
dbcreds_name
=
os
.
environ
.
get
(
"
TMSS_CLIENT_DBCREDENTIALS
"
,
"
TMSSClient
"
)
dbcreds_name
=
os
.
environ
.
get
(
"
TMSS_CLIENT_DBCREDENTIALS
"
,
"
TMSSClient
"
)
from
lofar.common.dbcredentials
import
DBCredentials
dbcreds
=
DBCredentials
().
get
(
dbcreds_name
)
dbcreds
=
DBCredentials
().
get
(
dbcreds_name
)
return
TMSSsession
.
create_from_dbcreds
(
dbcreds
)
@staticmethod
def
create_from_dbcreds
(
dbcreds
:
DBCredentials
):
'''
Factory method to create a TMSSSession object which uses the credentials in the dbcreds object.
See also: create_from_dbcreds_for_ldap
'''
return
TMSSsession
(
username
=
dbcreds
.
user
,
password
=
dbcreds
.
password
,
return
TMSSsession
(
username
=
dbcreds
.
user
,
password
=
dbcreds
.
password
,
host
=
dbcreds
.
host
,
host
=
dbcreds
.
host
,
port
=
dbcreds
.
port
,
port
=
dbcreds
.
port
,
...
...
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