Revision eb765213 snf-astakos-app/astakos/im/register.py
b/snf-astakos-app/astakos/im/register.py | ||
---|---|---|
121 | 121 |
return resource_dict |
122 | 122 |
|
123 | 123 |
|
124 |
def add_endpoint(service, endpoint_dict):
|
|
124 |
def add_endpoint(component, service, endpoint_dict, out=None):
|
|
125 | 125 |
endpoint = Endpoint.objects.create(service=service) |
126 | 126 |
for key, value in endpoint_dict.iteritems(): |
127 |
base_url = component.base_url |
|
128 |
if key == "publicURL" and not value.startswith(base_url): |
|
129 |
warn = out.write if out is not None else logger.warning |
|
130 |
warn("Warning: Endpoint URL '%s' does not start with " |
|
131 |
"assumed component base URL '%s'.\n" % (value, base_url)) |
|
127 | 132 |
EndpointData.objects.create( |
128 | 133 |
endpoint=endpoint, key=key, value=value) |
129 | 134 |
|
130 | 135 |
|
131 |
def add_service(component, name, service_type, endpoints): |
|
136 |
def add_service(component, name, service_type, endpoints, out=None):
|
|
132 | 137 |
defaults = {'component': component, |
133 | 138 |
'type': service_type, |
134 | 139 |
} |
... | ... | |
146 | 151 |
service.save() |
147 | 152 |
|
148 | 153 |
for endpoint in endpoints: |
149 |
add_endpoint(service, endpoint)
|
|
154 |
add_endpoint(component, service, endpoint, out=out)
|
|
150 | 155 |
|
151 | 156 |
return not created |
Also available in: Unified diff