Fix port hardcoded on APILink sample

Now the sample will reflect what's in the configuration.

Change-Id: Ia72baca546dfa1f052e0a646017810d91fcab97b
This commit is contained in:
Stéphane Albert 2016-06-30 17:34:27 +02:00
parent 9a26753b3b
commit c05efd2f97

View File

@ -15,6 +15,7 @@
#
# @author: Stéphane Albert
#
from oslo_config import cfg
import pecan
from pecan import rest
from wsme import types as wtypes
@ -22,6 +23,9 @@ import wsmeext.pecan as wsme_pecan
from cloudkitty.api.v1 import controllers as v1_api
CONF = cfg.CONF
CONF.import_opt('port', 'cloudkitty.api.app', 'api')
class APILink(wtypes.Base):
"""API link description.
@ -43,7 +47,8 @@ class APILink(wtypes.Base):
sample = cls(
rel='self',
type='text/html',
href='http://127.0.0.1:8889/{id}'.format(
href='http://127.0.0.1:{port}/{id}'.format(
port=CONF.api.port,
id=version))
return sample