Skip to content

Commit

Permalink
Add a task to install a pkg on all nodes with a specific role
Browse files Browse the repository at this point in the history
Needed for test purposes

Closes-Bug: 1582880
Change-Id: Ic30c0400626d859c5e2ca4930f4c666339f3a651
  • Loading branch information
Vedu Joshi committed May 18, 2016
1 parent e5914bb commit 7ca64a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions fabfile/tasks/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def apt_install(debs):
for deb in debs:
sudo(cmd + deb)

@task
def pkg_install(pkgs,disablerepo = False):
if detect_ostype() in ['ubuntu']:
apt_install(pkgs)
Expand Down
10 changes: 10 additions & 0 deletions fabfile/tasks/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,13 @@ def run_rally(task_args_file=None):
with cd('/usr/share/rally/samples/tasks/scenarios/custom'):
run("python run_rally.py --task-args '" + yaml.dump(testbed.rally_task_args).rstrip('\n') + "'")
# end run_rally

@roles('build')
@task
def install_pkgs_on_roles(role_names, package_names, disablerepo=False):
''' Install ubuntu/centos packages on all nodes with specific role
'''
pkgs = package_names.split(',')
roles = role_names.split(',')
execute('pkg_install', pkgs, disablerepo=disablerepo, roles=roles)
# end install_pkgs_on_roles

0 comments on commit 7ca64a4

Please sign in to comment.