From 8f6ce6746afa158fbb986bf0fb88ec058a327392 Mon Sep 17 00:00:00 2001 From: Josh Koenig Date: Tue, 1 Mar 2011 13:53:39 -0800 Subject: [PATCH] templatizing the bcfg2_host --- fab/initialization.py | 9 +++++++-- fab/templates/bcfg2.conf | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fab/initialization.py b/fab/initialization.py index 80acf8c..945fbb8 100644 --- a/fab/initialization.py +++ b/fab/initialization.py @@ -7,9 +7,10 @@ import update from pantheon import pantheon -def initialize(vps=None): +def initialize(vps=None, bcfg2_host='config.getpantheon.com'): '''Initialize the Pantheon system.''' server = pantheon.PantheonServer() + server.bcfg2_host = bcfg2_host _initialize_fabric() _initialize_certificate() @@ -84,7 +85,11 @@ def _initialize_bcfg2(server): elif server.distro == 'centos': local('yum -y install bcfg2 gamin gamin-python python-genshi ' + \ 'python-ssl python-lxml libxslt') - pantheon.copy_template('bcfg2.conf', '/etc/') + template = pantheon.get_template('bcfg2.conf') + bcfg2_conf = pantheon.build_template(template, {"bcfg2_host": server.bcfg2_host}) + with open('/etc/bcfg2.conf', 'w') as f: + f.write(bcfg2_conf) + # We use our own key/certs. local('rm -f /etc/bcfg2.key bcfg2.crt') # Run bcfg2 diff --git a/fab/templates/bcfg2.conf b/fab/templates/bcfg2.conf index 669d5ff..d26e5dc 100644 --- a/fab/templates/bcfg2.conf +++ b/fab/templates/bcfg2.conf @@ -16,4 +16,4 @@ user = mercury ca = /usr/share/ca-certificates/pantheon.crt [components] -bcfg2 = https://config.getpantheon.com:6789 +bcfg2 = https://${bcfg2_host}:6789