Skip to content

Commit

Permalink
added option for packages of backend production machine, refs #14392
Browse files Browse the repository at this point in the history
  • Loading branch information
michal dub committed Jul 1, 2011
1 parent 480a9a8 commit dd885d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion citools/fabfile.py
Expand Up @@ -179,7 +179,7 @@ def getlistpackageslocal(dpkgl_file):
result[row[0]] = [row[0], row[1]]
return result

def install_production_packages(clean_machine, production_machine):
def install_production_packages(clean_machine, production_machine, production_backend_machine=None):
"""
This function get dpkg -l from url from production and install it including versions
Has two required arguments the clean machine for installing production packages and production machine for comparation packages
Expand Down Expand Up @@ -210,6 +210,11 @@ def install_production_packages(clean_machine, production_machine):

dpkgl_file = urllib.urlopen('http://cml.tunel.chservices.cz/cgi-bin/dpkg.pl?host=%s' % (production_machine,))
PACKAGES_LIST = getlistpackages(dpkgl_file)
if production_backend_machine:
dpkgl_file = urllib.urlopen('http://cml.tunel.chservices.cz/cgi-bin/dpkg.pl?host=%s' % (production_backend_machine,))
backend_packages_list = getlistpackages(dpkgl_file)
backend_packages_list.update(PACKAGES_LIST)
PACKAGES_LIST = backend_packages_list

client = paramiko.SSHClient()
client.load_system_host_keys()
Expand Down
6 changes: 4 additions & 2 deletions citools/pavement.py
Expand Up @@ -242,19 +242,21 @@ def ping_buildmaster():
@task
@cmdopts([
('production-machine=', 'p', 'Production machine'),
('clean-machine=', 'c', 'Clean machine')
('clean-machine=', 'c', 'Clean machine'),
('production-backend-machine=', 'b', 'Production backend machine')
])
def install_production_packages(options):
production_machine = getattr(options, "production_machine")
clean_machine = getattr(options, "clean_machine")
production_backend_machine = getattr(options, "production_backend_machine", None)
fabfile_name = getattr(options, "fabfile_name", '')
# import your fabfile
if fabfile_name != '':
fabfile = import_fabfile(fabfile_name)
else:
fabfile = import_fabfile()
# invoke fabric task
args = (clean_machine, production_machine)
args = (clean_machine, production_machine, production_backend_machine)
options.packages_list = fab(clean_machine,
fabfile['install_production_packages'],
resolve,
Expand Down

0 comments on commit dd885d8

Please sign in to comment.