Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
synnefo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
itminedu
synnefo
Commits
e7042ebd
Commit
e7042ebd
authored
12 years ago
by
Georgios D. Tsoukalas
Browse files
Options
Downloads
Patches
Plain Diff
pithos: initialize prefixes from service catalog
parent
d9d760cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
snf-pithos-app/pithos/api/services.py
+65
-0
65 additions, 0 deletions
snf-pithos-app/pithos/api/services.py
snf-pithos-app/pithos/api/settings.py
+17
-5
17 additions, 5 deletions
snf-pithos-app/pithos/api/settings.py
snf-pithos-app/pithos/api/urls.py
+7
-5
7 additions, 5 deletions
snf-pithos-app/pithos/api/urls.py
with
89 additions
and
10 deletions
snf-pithos-app/pithos/api/services.py
0 → 100644
+
65
−
0
View file @
e7042ebd
# Copyright (C) 2013 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and
# documentation are those of the authors and should not be
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
pithos_services
=
{
'
pithos_object-store
'
:
{
'
type
'
:
'
object-store
'
,
'
component
'
:
'
pithos
'
,
'
prefix
'
:
'
object-store
'
,
'
public
'
:
True
,
'
endpoints
'
:
[
{
'
version
'
:
'
v1
'
,
'
publicURL
'
:
None
},
]},
'
pithos_public
'
:
{
'
type
'
:
'
public
'
,
'
component
'
:
'
pithos
'
,
'
prefix
'
:
'
public
'
,
'
public
'
:
True
,
'
endpoints
'
:
[
{
'
version
'
:
'
v2.0
'
,
'
publicURL
'
:
None
},
]},
'
pithos_ui
'
:
{
'
type
'
:
'
pithos_ui
'
,
'
component
'
:
'
pithos
'
,
'
prefix
'
:
'
ui
'
,
'
public
'
:
True
,
'
endpoints
'
:
[
{
'
version
'
:
''
,
'
publicURL
'
:
None
},
]},
}
This diff is collapsed.
Click to expand it.
snf-pithos-app/pithos/api/settings.py
+
17
−
5
View file @
e7042ebd
#coding=utf8
from
django.conf
import
settings
from
synnefo.lib
import
parse_base_url
from
astakosclient
import
astakos_services
from
synnefo.util.keypath
import
get_path
from
pithos.api.services
import
pithos_services
# Top-level URL for Pithos. Must set.
BASE_URL
=
getattr
(
settings
,
'
PITHOS_BASE_URL
'
,
"
https://
pithos
.example.synnefo.org/
"
)
"
https://
object-store
.example.synnefo.org/
pithos/
"
)
BASE_HOST
,
BASE_PATH
=
parse_base_url
(
BASE_URL
)
# Process Astakos settings
ASTAKOS_BASE_URL
=
getattr
(
settings
,
'
ASTAKOS_BASE_URL
'
,
"
https://accounts.example.synnefo.org/
"
)
'
https://accounts.example.synnefo.org/astakos/
'
)
ASTAKOS_BASE_HOST
,
ASTAKOS_BASE_PATH
=
parse_base_url
(
ASTAKOS_BASE_URL
)
PITHOS_PREFIX
=
get_path
(
pithos_services
,
'
pithos_object-store.prefix
'
)
PUBLIC_PREFIX
=
get_path
(
pithos_services
,
'
pithos_public.prefix
'
)
UI_PREFIX
=
get_path
(
pithos_services
,
'
pithos_ui.prefix
'
)
CUSTOMIZE_ASTAKOS_SERVICES
=
\
getattr
(
settings
,
'
PITHOS_CUSTOMIZE_ASTAKOS_SERVICES
'
,
())
for
path
,
value
in
CUSTOMIZE_ASTAKOS_SERVICES
:
set_path
(
astakos_services
,
path
,
value
,
createpath
=
True
)
ASTAKOS_ACCOUNT_PREFIX
=
get_path
(
astakos_services
,
'
astakos_account.prefix
'
)
BASE_ASTAKOS_PROXY_PATH
=
getattr
(
settings
,
'
PITHOS_BASE_ASTAKOS_PROXY_PATH
'
,
ASTAKOS_BASE_PATH
)
ASTAKOS_ACCOUNTS_PREFIX
=
getattr
(
settings
,
'
ASTAKOS_ACCOUNTS_PREFIX
'
,
'
accounts
'
)
ASTAKOSCLIENT_POOLSIZE
=
getattr
(
settings
,
'
PITHOS_ASTAKOSCLIENT_POOLSIZE
'
,
200
)
...
...
This diff is collapsed.
Click to expand it.
snf-pithos-app/pithos/api/urls.py
+
7
−
5
View file @
e7042ebd
...
...
@@ -37,7 +37,8 @@ from snf_django.lib.api.proxy import proxy
from
snf_django.lib.api.utils
import
prefix_pattern
from
pithos.api.settings
import
(
BASE_PATH
,
ASTAKOS_BASE_URL
,
BASE_ASTAKOS_PROXY_PATH
,
ASTAKOS_ACCOUNTS_PREFIX
,
PROXY_USER_SERVICES
)
ASTAKOS_ACCOUNT_PREFIX
,
PROXY_USER_SERVICES
,
PITHOS_PREFIX
,
PUBLIC_PREFIX
,
UI_PREFIX
)
from
urlparse
import
urlparse
...
...
@@ -53,9 +54,10 @@ pithos_api_patterns = patterns(
pithos_patterns
=
patterns
(
''
,
(
r
'
^v1(?:$|/)
'
,
include
(
pithos_api_patterns
)),
(
r
'
^v1\.0(?:$|/)
'
,
include
(
pithos_api_patterns
)),
(
r
'
^public/(?P<v_public>.+?)/?$
'
,
'
pithos.api.public.public_demux
'
))
(
r
'
{0}v1/
'
.
format
(
prefix_pattern
(
PITHOS_PREFIX
)),
include
(
pithos_api_patterns
)),
(
r
'
{0}(?P<v_public>.+?)/?$
'
.
format
(
prefix_pattern
(
PUBLIC_PREFIX
)),
'
pithos.api.public.public_demux
'
))
urlpatterns
=
patterns
(
''
,
...
...
@@ -71,7 +73,7 @@ if PROXY_USER_SERVICES:
(
r
'
^login/?$
'
,
astakos_proxy
),
(
r
'
^feedback/?$
'
,
astakos_proxy
),
(
r
'
^user_catalogs/?$
'
,
astakos_proxy
),
(
prefix_pattern
(
ASTAKOS_ACCOUNT
S
_PREFIX
),
astakos_proxy
),
(
prefix_pattern
(
ASTAKOS_ACCOUNT_PREFIX
),
astakos_proxy
),
)
urlpatterns
+=
patterns
(
...
...
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