Skip to content

Commit

Permalink
Allow to customize the remote services location
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignasi Barrera committed Sep 7, 2012
1 parent 4c87c48 commit 108a269
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions config/env.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[datacenter]
name = Hawaii ; The name of the datacenter
location = Honolulu ; The location of the datacenter
#rs = 10.60.1.222 ; (Optional) The address for the remote services

[rack]
name = Coconut rack ; The name of the rack
Expand Down
8 changes: 5 additions & 3 deletions kahuna/plugins/environment/infrastructure/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ def __init__(self, context):
""" Initialize with an existent context """
self.__context = context.getApiContext()

def create_datacenter(self, name, location):
def create_datacenter(self, name, location, rs_address):
""" Creates a new datacenter """
log.info("Creating datacenter %s at %s..." % (name, location))
rs_address = self.__context.getEndpoint().getHost()
datacenter = Datacenter.builder(self.__context) \
.name(name) \
.location(location) \
Expand Down Expand Up @@ -69,8 +68,11 @@ def create_infrastructure_compute(config, context):
""" Creates the default infrastructure compute entities. """
log.info("### Configuring infrastructure ###")
comp = InfrastructureCompute(context)
rs_address = config.get("datacenter", "rs") \
if config.has_option("datacenter", "rs") \
else context.getApiContext().getEndpoint().getHost()
dc = comp.create_datacenter(config.get("datacenter", "name"),
config.get("datacenter", "location"))
config.get("datacenter", "location"), rs_address)
rack = comp.create_rack(dc, config.get("rack", "name"),
config.getint("rack", "vlan-min"),
config.getint("rack", "vlan-max"),
Expand Down

0 comments on commit 108a269

Please sign in to comment.