Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
e7042ebd
Commit
e7042ebd
authored
May 31, 2013
by
Georgios D. Tsoukalas
Browse files
pithos: initialize prefixes from service catalog
parent
d9d760cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
snf-pithos-app/pithos/api/services.py
0 → 100644
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
},
]},
}
snf-pithos-app/pithos/api/settings.py
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
)
...
...
snf-pithos-app/pithos/api/urls.py
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
(
...
...
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