@task
def haproxy_install():
 fprint('Rsync thirdparty/haproxy ~/haproxy')
 rsync_project(local_dir='third_party/haproxy/', remote_dir='~/haproxy/', ssh_opts='-o StrictHostKeyChecking=no')
 fprint('Building haproxy')
 run('haproxy/build.sh ~/')
 fprint('Generating viewfinder.pem for haproxy')
 vf_passphrase = load_passphrase_from_file()
 local(('scripts/generate_haproxy_certificate.sh viewfinder.co %s viewfinder.pem' % vf_passphrase))
 run('mkdir -p ~/conf')
 run('rm -f ~/conf/viewfinder.pem')
 put('viewfinder.pem', '~/conf/viewfinder.pem')
 run('chmod 400 ~/conf/viewfinder.pem')
 local('rm -f viewfinder.pem')
 fprint('Pushing haproxy configs')
 assert env.nodetype, 'no nodetype specified'
 run('ln -f -s ~/viewfinder/scripts/haproxy.conf ~/conf/haproxy.conf')
 run(('ln -f -s ~/viewfinder/scripts/haproxy.redirect.%s.conf ~/conf/haproxy.redirect.conf' % env.nodetype.lower()))

@ task def haproxy_install ( ) : fprint ( 'Rsync thirdparty/haproxy ~/haproxy' ) rsync_project ( local_dir = 'third_party/haproxy/' , remote_dir = '~/haproxy/' , ssh_opts = '-o StrictHostKeyChecking=no' ) fprint ( 'Building haproxy' ) run ( 'haproxy/build.sh ~/' ) fprint ( 'Generating viewfinder.pem for haproxy' ) vf_passphrase = load_passphrase_from_file ( ) local ( ( 'scripts/generate_haproxy_certificate.sh viewfinder.co %s viewfinder.pem' % vf_passphrase ) ) run ( 'mkdir -p ~/conf' ) run ( 'rm -f ~/conf/viewfinder.pem' ) put ( 'viewfinder.pem' , '~/conf/viewfinder.pem' ) run ( 'chmod 400 ~/conf/viewfinder.pem' ) local ( 'rm -f viewfinder.pem' ) fprint ( 'Pushing haproxy configs' ) assert env . nodetype , 'no nodetype specified' run ( 'ln -f -s ~/viewfinder/scripts/haproxy.conf ~/conf/haproxy.conf' ) run ( ( 'ln -f -s ~/viewfinder/scripts/haproxy.redirect.%s.conf ~/conf/haproxy.redirect.conf' % env . nodetype . lower ( ) ) )
install and configure haproxy .