Commit cc7f14b7 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

ci: Add --name option to override server name

parent 0b75c2b6
......@@ -74,6 +74,8 @@ def main(): # Too many branches. pylint: disable-msg=R0912
parser.add_option("--ssh-keys", dest="ssh_keys", default=None,
help="Upload/Install the public ssh keys contained"
" in this file to the server")
parser.add_option("--name", dest="server_name", default=None,
help=""),
parser.add_option("-n", "--build-id", dest="build_id", default=None,
type="int",
help="Specify a number to use to identify this build."
......@@ -143,7 +145,8 @@ def main(): # Too many branches. pylint: disable-msg=R0912
if getattr(options, CREATE_SERVER_CMD, False):
synnefo_ci.create_server(flavor=options.flavor,
image=options.image,
ssh_keys=options.ssh_keys)
ssh_keys=options.ssh_keys,
server_name=options.server_name)
synnefo_ci.clone_repo(local_repo=options.local_repo)
if getattr(options, BUILD_SYNNEFO_CMD, False):
synnefo_ci.build_packages()
......
......@@ -252,7 +252,8 @@ class SynnefoCI(object):
self._wait_transition(server_id, "ACTIVE", "DELETED")
@_check_kamaki
def create_server(self, image=None, flavor=None, ssh_keys=None):
def create_server(self, image=None, flavor=None, ssh_keys=None,
server_name=None):
"""Create slave server"""
self.logger.info("Create a new server..")
......@@ -265,11 +266,11 @@ class SynnefoCI(object):
flavor_id = self._find_flavor(flavor)
# Create Server
server_name = self.config.get("Deployment", "server_name")
server = self.cyclades_client.create_server(
"%s(BID: %s)" % (server_name, self.build_id),
flavor_id,
image_id)
if server_name is None:
server_name = self.config.get("Deployment", "server_name")
server_name = "%s(BID: %s)" % (server_name, self.build_id)
server = self.cyclades_client.create_server(server_name, flavor_id,
image_id)
server_id = server['id']
self.write_temp_config('server_id', server_id)
self.logger.debug("Server got id %s" % _green(server_id))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment