Handle lack of rpms or debs in devstack-cache.

* modules/openstack_project/files/nodepool/scripts/devstack-cache.py:
When running on Ubuntu only debs will be listed for install, when
running on Fedora only RPMs will be listed for install. Handle the lack
of the other when checking which should be installed (use dict.get
instead of a normal index operation which will throw a KeyError instead
of returning None). Add an error message if no debs or rpms are found.

Change-Id: Iafb57f43ce6b51414593b909e1a9fde7c7c0ebf0
This commit is contained in:
Clark Boylan 2013-11-27 10:08:06 -08:00
parent d1c2943a99
commit b266a26a98

View File

@ -116,13 +116,14 @@ def main():
branches = local_prep(distribution)
image_filenames = {}
for branch_data in branches:
if branch_data['debs']:
if branch_data.get('debs'):
run_local(['sudo', 'apt-get', '-y', '-d', 'install'] +
branch_data['debs'])
if branch_data['rpms']:
elif branch_data.get('rpms'):
run_local(['sudo', 'yum', 'install', '-y', '--downloadonly'] +
branch_data['rpms'])
else:
sys.exit('No supported package data found.')
for url in branch_data['images']:
fname = url.split('/')[-1]