Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
b5c26f23
Commit
b5c26f23
authored
10 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
adapt centralclient to use updated central api
parent
a3c2d85f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api.wsgi
+1
-1
1 addition, 1 deletion
api.wsgi
centralclient.py
+4
-3
4 additions, 3 deletions
centralclient.py
with
5 additions
and
4 deletions
api.wsgi
+
1
−
1
View file @
b5c26f23
...
...
@@ -18,7 +18,7 @@ ap.add_argument('--db_uri', help='mongodb uri', required=True)
ap.add_argument('--data_path', help='path to data', required=True)
ap.add_argument('--log_path', help='path to log', required=True) # for SHOWING the log, not where to write
ap.add_argument('--ssl_cert', help='path to ssl cert in pem format, key+cert', required=True)
ap.add_argument('--api_uri', help='api uri')
ap.add_argument('--api_uri', help='api uri
, with https:// prefix
')
ap.add_argument('--site_id', help='site id')
ap.add_argument('--site_name', help='site name', nargs='+')
ap.add_argument('--oauth2_id_endpoint', help='oauth2 id endpoint url', default='https://www.googleapis.com/plus/v1/people/me/openIdConnect')
...
...
This diff is collapsed.
Click to expand it.
centralclient.py
+
4
−
3
View file @
b5c26f23
...
...
@@ -29,9 +29,10 @@ def update(db, api_uri, site_name, site_id, ssl_cert, central_url):
remote_users
=
set
([(
user
[
'
_id
'
],
user
[
'
site
'
])
for
container
in
proj_userlist
+
col_userlist
+
grp_userlist
for
user
in
container
if
user
.
get
(
'
site
'
)
is
not
None
])
remote_users
=
[{
'
user
'
:
user
[
0
],
'
site
'
:
user
[
1
]}
for
user
in
remote_users
]
payload
=
json
.
dumps
({
'
_id
'
:
site_id
,
'
api_uri
'
:
api_uri
,
'
users
'
:
remote_users
,
'
name
'
:
site_name
})
payload
=
json
.
dumps
({
'
api_uri
'
:
api_uri
,
'
users
'
:
remote_users
,
'
name
'
:
site_name
})
route
=
'
%s/%s/%s
'
%
(
central_url
,
'
instances
'
,
site_id
)
try
:
r
=
requests
.
p
ost
(
central_url
,
data
=
payload
,
cert
=
ssl_cert
)
r
=
requests
.
p
ut
(
route
,
data
=
payload
,
cert
=
ssl_cert
)
except
requests
.
exceptions
.
ConnectionError
:
log
.
debug
(
'
SDMC is not reachable
'
)
else
:
...
...
@@ -89,7 +90,7 @@ if __name__ == '__main__':
arg_parser
=
argparse
.
ArgumentParser
()
arg_parser
.
add_argument
(
'
--central_url
'
,
help
=
'
Scitran Central API URL
'
,
default
=
'
https://sdmc.scitran.io
'
)
arg_parser
.
add_argument
(
'
--db_uri
'
,
help
=
'
DB URI
'
,
required
=
True
)
arg_parser
.
add_argument
(
'
--api_uri
'
,
help
=
'
API URL, with
out
http://
or https://
'
,
required
=
True
)
arg_parser
.
add_argument
(
'
--api_uri
'
,
help
=
'
API URL, with http
s
://
prefix
'
,
required
=
True
)
arg_parser
.
add_argument
(
'
--site_id
'
,
help
=
'
instance hostname (used as unique ID)
'
,
required
=
True
)
arg_parser
.
add_argument
(
'
--site_name
'
,
help
=
'
instance name
'
,
nargs
=
'
+
'
,
required
=
True
)
arg_parser
.
add_argument
(
'
--ssl_cert
'
,
help
=
'
path to server ssl certificate file
'
,
required
=
True
)
...
...
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