Skip to content

Commit

Permalink
removing unused path_prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
advornic committed Jan 12, 2015
1 parent 728806e commit 418344d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 43 deletions.
6 changes: 2 additions & 4 deletions conf/ztpserver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ disable_topology_validation = False


[server]

# Note: this section only applies to using the standalone server. If
# running under a WSGI server, these values are ignored

Expand All @@ -35,17 +34,16 @@ port = 8080
[ files]
# Path for the files directory (overriding data_root/files)
folder = files
path_prefix = /usr/share/ztpserver


[actions]
# Path for the actions directory (overriding data_root/actions)
folder = actions
path_prefix = /usr/share/ztpserver


[bootstrap]
# Path for the bootstrap directory (overriding data_root/bootstrap)
folder = bootstrap
path_prefix = /usr/share/ztpserver

# Bootstrap filename
filename = bootstrap
Expand Down
6 changes: 0 additions & 6 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,16 @@ If the global configuration file is updated, the server must be restarted in ord
# Path for the files directory (overriding data_root/files)
# default=files
folder=<path>
# default=data_root (from above)
path_prefix=<path>
[actions]
# Path for the actions directory (overriding data_root/actions)
# default=actions
folder=<path>
# default=data_root (from above)
path_prefix=<path>
[bootstrap]
# Path for the bootstrap directory (overriding data_root/bootstrap)
# default=bootstrap
folder=<path>
# default=data_root (from above)
path_prefix=<path>
# Bootstrap filename
# default=bootstrap
Expand Down
3 changes: 0 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,14 @@ Global configuration file
[ files]
# Path for the files directory (overriding data_root/files)
folder = files
path_prefix = /usr/share/ztpserver
[actions]
# Path for the actions directory (overriding data_root/actions)
folder = actions
path_prefix = /usr/share/ztpserver
[bootstrap]
# Path for the bootstrap directory (overriding data_root/bootstrap)
folder = bootstrap
path_prefix = /usr/share/ztpserver
# Bootstrap filename
filename = bootstrap
Expand Down
18 changes: 0 additions & 18 deletions ztpserver/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,6 @@ def read(self, filename):
environ='ZTPS_FILES_FOLDER'
))

runtime.add_attribute(StrAttr(
name='path_prefix',
group='files',
environ='ZTPS_FILES_PATH_PREFIX'
))

# Group: actions
runtime.add_attribute(StrAttr(
name='folder',
Expand All @@ -361,12 +355,6 @@ def read(self, filename):
environ='ZTPS_ACTIONS_FOLDER'
))

runtime.add_attribute(StrAttr(
name='path_prefix',
group='actions',
environ='ZTPS_ACTIONS_PATH_PREFIX'
))

# Group: bootstrap
runtime.add_attribute(StrAttr(
name='folder',
Expand All @@ -375,12 +363,6 @@ def read(self, filename):
environ='ZTPS_BOOTSTRAP_FOLDER'
))

runtime.add_attribute(StrAttr(
name='path_prefix',
group='bootstrap',
environ='ZTPS_BOOTSTRAP_PATH_PREFIX'
))

runtime.add_attribute(StrAttr(
name='filename',
group='bootstrap',
Expand Down
14 changes: 2 additions & 12 deletions ztpserver/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import logging
import os
import routes
import urlparse

from string import Template
from webob.static import FileApp
Expand Down Expand Up @@ -812,21 +811,12 @@ class Router(WSGIRouter):

def __init__(self):
# pylint: disable=E1103,W0142

mapper = routes.Mapper()

kwargs = {}

url = ztpserver.config.runtime.default.server_url
log.debug('server URL: %s', url)
parts = urlparse.urlsplit(url)
if parts.path:
path = parts.path[:-1] if parts.path.endswith('/') else parts.path
if path:
log.debug('path_prefix is %s', path)
kwargs['path_prefix'] = path

with mapper.submapper(**kwargs) as router_mapper:

with mapper.submapper() as router_mapper:

# configure /bootstrap
router_mapper.connect('bootstrap', '/bootstrap',
Expand Down

0 comments on commit 418344d

Please sign in to comment.