Fix launch-node for non-official environments.

Infrastructures derived from the OpenStack CI infrastructure currently
need to fork launch-node.py, better if it just takes an option ;).

Change-Id: Iad94451ed2b4da425f059595ae727dcf2847733a
This commit is contained in:
Robert Collins 2013-08-31 00:35:35 +12:00
parent 0e5baad93f
commit 5f717e6ec9
2 changed files with 14 additions and 6 deletions

View File

@ -44,6 +44,11 @@ automatically). Note that this example assumes you've already
exported a relevant FQDN and sourced the appropriate API credentials
above.
When running outside the official OpenStack CI infrastructure, you
will want to pass --server ci-puppetmaster.example.com otherwise the
new node wil try to register with ci-puppetmaster.openstack.org - and
fail hilariously.
Add DNS Records
===============

View File

@ -53,7 +53,7 @@ def get_client():
return client
def bootstrap_server(server, admin_pass, key, cert, environment, name,
salt_priv, salt_pub):
salt_priv, salt_pub, puppetmaster):
client = server.manager.api
ip = utils.get_public_ip(server)
if not ip:
@ -122,13 +122,14 @@ def bootstrap_server(server, admin_pass, key, cert, environment, name,
ssh_client.ssh("puppet agent "
"--environment %s "
"--server ci-puppetmaster.openstack.org "
"--server %s "
"--no-daemonize --verbose --onetime --pluginsync true "
"--certname %s" % (environment, certname))
"--certname %s" % (environment, puppetmaster, certname))
ssh_client.ssh("reboot")
def build_server(client, name, image, flavor, cert, environment, salt):
def build_server(
client, name, image, flavor, cert, environment, salt, puppetmaster):
key = None
server = None
@ -156,7 +157,7 @@ def build_server(client, name, image, flavor, cert, environment, salt):
admin_pass = server.adminPass
server = utils.wait_for_resource(server)
bootstrap_server(server, admin_pass, key, cert, environment, name,
salt_priv, salt_pub)
salt_priv, salt_pub, puppetmaster)
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (server.id,
server.accessIPv4,
server.accessIPv6))
@ -187,6 +188,8 @@ def main():
"hostname.example.com.pem)")
parser.add_argument("--salt", dest="salt", action="store_true",
help="Manage salt keys for this host.")
parser.add_argument("--server", dest="server", help="Puppetmaster to use.",
default="ci-puppetmaster.openstack.org")
options = parser.parse_args()
client = get_client()
@ -226,7 +229,7 @@ def main():
print "Found image", image
build_server(client, options.name, image, flavor, cert,
options.environment, options.salt)
options.environment, options.salt, options.server)
dns.print_dns(client, options.name)
if __name__ == '__main__':