Full parameterize the rest of keystones init yaml file with helper params

This commit is contained in:
Joshua Harlow
2012-05-31 12:43:48 -07:00
parent 4030669c9b
commit c7169d18e0
6 changed files with 100 additions and 38 deletions

View File

@@ -19,7 +19,6 @@ import collections
import glob import glob
from anvil import colorizer from anvil import colorizer
from anvil import date
from anvil import exceptions as excp from anvil import exceptions as excp
from anvil import log as logging from anvil import log as logging
from anvil import packager from anvil import packager
@@ -127,7 +126,7 @@ class Action(object):
Run a given 'functor' across all of the components, in order. Run a given 'functor' across all of the components, in order.
""" """
component_results = dict() component_results = dict()
phase_fn = "%s.%s.phases" % (self.get_action_name(), phase_name.lower()) phase_fn = "%s.%s.phases" % (self.get_action_name(), phase_name.lower())
phase_recorder = phase.PhaseRecorder(sh.joinpths(self.root_dir, phase_fn)) phase_recorder = phase.PhaseRecorder(sh.joinpths(self.root_dir, phase_fn))
for c in component_order: for c in component_order:
instance = instances[c] instance = instances[c]

View File

@@ -19,7 +19,6 @@ import os
import weakref import weakref
from anvil import cfg from anvil import cfg
from anvil import date
from anvil import exceptions from anvil import exceptions
from anvil import libvirt as lv from anvil import libvirt as lv
from anvil import log as logging from anvil import log as logging
@@ -126,10 +125,42 @@ def canon_virt_driver(virt_driver):
return virt_driver return virt_driver
def get_shared_params(cfg): def get_shared_params(cfgobj):
mp = dict() mp = dict()
host_ip = cfg.get('host', 'ip')
host_ip = cfgobj.get('host', 'ip')
mp['service_host'] = host_ip mp['service_host'] = host_ip
nova_host = cfgobj.getdefaulted('nova', 'nova_host', host_ip)
nova_protocol = cfgobj.getdefaulted('nova', 'nova_protocol', 'http')
# Uri's of the various nova endpoints
mp['endpoints'] = {
'ec2': {
'uri': utils.make_url(nova_protocol, nova_host, 8773, "services/Admin"),
'port': 8773,
'host': host_ip,
'protocol': nova_protocol,
},
'volume': {
'uri': utils.make_url(nova_protocol, host_ip, 8776, "v1"),
'port': 8776,
'host': host_ip,
'protocol': nova_protocol,
},
's3': {
'uri': utils.make_url('http', host_ip, 3333),
'port': 3333,
'host': host_ip,
'protocol': nova_protocol,
},
'api': {
'uri': utils.make_url('http', host_ip, 8774, "v2"),
'port': 8774,
'host': host_ip,
'protocol': nova_protocol,
},
}
return mp return mp

View File

@@ -26,4 +26,20 @@ def get_shared_params(cfg):
host_ip = cfg.get('host', 'ip') host_ip = cfg.get('host', 'ip')
mp['service_host'] = host_ip mp['service_host'] = host_ip
# Components of the various endpoints
quantum_host = cfg.getdefaulted('quantum', 'quantum_host', host_ip)
quantum_port = cfg.getdefaulted('quantum', 'quantum_port', '9696')
quantum_proto = cfg.getdefaulted('quantum', 'quantum_protocol', 'http')
quantum_uri = utils.make_url(quantum_proto, quantum_host, quantum_port)
mp['endpoints'] = {
'admin': {
'uri': quantum_uri,
'port': quantum_port,
'protocol': quantum_proto,
'host': quantum_host,
},
}
mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
mp['endpoints']['internal'] = dict(mp['endpoints']['public'])
return mp return mp

View File

@@ -26,4 +26,20 @@ def get_shared_params(cfg):
host_ip = cfg.get('host', 'ip') host_ip = cfg.get('host', 'ip')
mp['service_host'] = host_ip mp['service_host'] = host_ip
# Components of the various endpoints
swift_host = cfg.getdefaulted('swift', 'swift_host', host_ip)
swift_port = cfg.getdefaulted('swift', 'swift_port', '8080')
swift_proto = cfg.getdefaulted('swift', 'swift_protocol', 'http')
swift_uri = utils.make_url(swift_proto, swift_host, swift_port)
mp['endpoints'] = {
'admin': {
'uri': swift_uri,
'port': swift_port,
'protocol': swift_proto,
'host': swift_host,
},
}
mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
mp['endpoints']['internal'] = dict(mp['endpoints']['public'])
return mp return mp

View File

@@ -28,7 +28,7 @@ HELP_WIDTH = 80
def _format_list(in_list): def _format_list(in_list):
sorted_list = sorted(in_list) sorted_list = sorted(in_list)
return "[" + ", ".join(sorted_list) + "]" return "[" + ", ".join(sorted_list) + "]"
def parse(): def parse():

View File

@@ -1,45 +1,45 @@
--- ---
endpoints: endpoints:
- admin_url: http://%swift.service_host%:8080/v1/AUTH_%(tenant_id)s - service: swift
internal_url: http://%swift.service_host%:8080/ admin_url: "%swift.endpoints.admin.uri%/v1/AUTH_%(tenant_id)s"
public_url: http://%swift.service_host%:8080/v1/AUTH_%(tenant_id)s internal_url: "%swift.endpoints.internal.uri%"
public_url: "%swift.endpoints.public.uri%/v1/AUTH_%(tenant_id)s"
region: RegionOne region: RegionOne
service: swift - service: ec2
- admin_url: http://%nova.service_host%:8773/services/Admin admin_url: "%nova.endpoints.ec2.uri%"
internal_url: http://%nova.service_host%:8773/services/Cloud internal_url: "%nova.endpoints.ec2.uri%"
public_url: http://%nova.service_host%:8773/services/Cloud public_url: "%nova.endpoints.ec2.uri%"
region: RegionOne region: RegionOne
service: ec2 - service: network
- admin_url: http://%quantum.service_host%:9696/ admin_url: "%quantum.endpoints.admin.uri%"
internal_url: http://%quantum.service_host%:9696/ internal_url: "%quantum.endpoints.internal.uri%"
public_url: http://%quantum.service_host%:9696/ public_url: "%quantum.endpoints.public.uri%"
region: RegionOne region: RegionOne
service: network - service: glance
- admin_url: http://%glance.service_host%:9292 admin_url: "%glance.endpoints.admin.uri%"
internal_url: http://%glance.service_host%:9292 internal_url: "%glance.endpoints.internal.uri%"
public_url: http://%glance.service_host%:9292 public_url: "%glance.endpoints.public.uri%"
region: RegionOne region: RegionOne
service: glance - service: volume
- admin_url: http://%nova.service_host%:8776/v1/%(tenant_id)s admin_url: "%nova.endpoints.volume.uri%/%(tenant_id)s"
internal_url: http://%nova.service_host%:8776/v1/%(tenant_id)s internal_url: "%nova.endpoints.volume.uri%/%(tenant_id)s"
public_url: http://%nova.service_host%:8776/v1/%(tenant_id)s public_url: "%nova.endpoints.volume.uri%/%(tenant_id)s"
region: RegionOne region: RegionOne
service: volume - service: s3
- admin_url: http://%nova.service_host%:3333 admin_url: "%nova.endpoints.s3.uri%"
internal_url: http://%nova.service_host%:3333 internal_url: "%nova.endpoints.s3.uri%"
public_url: http://%nova.service_host%:3333 public_url: "%nova.endpoints.s3.uri%"
region: RegionOne region: RegionOne
service: s3 - service: keystone
- admin_url: http://%keystone.service_host%:$(admin_port)s/v2.0 admin_url: "%keystone.endpoints.admin.uri%"
internal_url: http://%keystone.service_host%:$(public_port)s/v2.0 internal_url: "%keystone.endpoints.internal.uri%"
public_url: http://%keystone.service_host%:$(public_port)s/v2.0 public_url: "%keystone.endpoints.public.uri%"
region: RegionOne region: RegionOne
service: keystone - service: nova
- admin_url: http://%nova.service_host%:8774/v2/%(tenant_id)s admin_url: "%nova.endpoints.api.uri%/%(tenant_id)s"
internal_url: http://%nova.service_host%:8774/v2/%(tenant_id)s internal_url: "%nova.endpoints.api.uri%/%(tenant_id)s"
public_url: http://%nova.service_host%:8774/v2/%(tenant_id)s public_url: "%nova.endpoints.api.uri%/%(tenant_id)s"
region: RegionOne region: RegionOne
service: nova
roles: roles:
- admin - admin
- anotherrole - anotherrole