summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Lawrance <stl@redhat.com>2011-07-18 15:04:15 +1000
committerSteven Lawrance <stl@redhat.com>2011-07-18 15:04:15 +1000
commit8e6ef62f6b7c1907b69c5dd41d11aae5def4622c (patch)
treed7fa8dfdd91e2ef809c2455710b58993a8072906
parentb79835977a1976d8d5998623c9613df0ddaddd9d (diff)
Avoid IndexError if getdriver.sh returns only one linebeaker-distribution-inventory-1_1-52
-rwxr-xr-xTasks/distribution/inventory/push-inventory.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Tasks/distribution/inventory/push-inventory.py b/Tasks/distribution/inventory/push-inventory.py
index 8d52dde..5377d02 100755
--- a/Tasks/distribution/inventory/push-inventory.py
+++ b/Tasks/distribution/inventory/push-inventory.py
@@ -299,8 +299,11 @@ def read_inventory():
if line.find('0.0.0.0') == 0:
iface = line.split()[-1:][0] #eth0, eth1, etc..
if iface:
- driver = commands.getstatusoutput('./getdriver.sh %s' % iface)[1].split('\n')[1:][0]
- data['NETWORK'] = driver
+ drivers = commands.getstatusoutput('./getdriver.sh %s' % iface)[1].split('\n')
+ if len(drivers) == 1:
+ data['NETWORK'] = drivers[0]
+ else:
+ data['NETWORK'] = drivers[1:][0]
disks = Disks()
data['DISK'] = disks.disks