From de32ddca574150806c4dbb9a47930b0b6d1196f0 Mon Sep 17 00:00:00 2001 From: git-harry Date: Tue, 10 Feb 2015 14:33:14 +0000 Subject: [PATCH] Remove ImportError handling in dynamic_inventory The import of netaddr any yaml is done within a try/except block. If an ImportError occurs an error message is printed and the script ignores it. Ansible does not display the printed message and the script will still fail, just later on. This commit removes the exception handling so that if there is an ImportError the script will fail straight away. Change-Id: Iff935db62bde954ac4ff0b920409c18dd494bdff Closes-Bug: #1420312 --- rpc_deployment/inventory/dynamic_inventory.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/rpc_deployment/inventory/dynamic_inventory.py b/rpc_deployment/inventory/dynamic_inventory.py index db0f47d8e3..da99866fe9 100755 --- a/rpc_deployment/inventory/dynamic_inventory.py +++ b/rpc_deployment/inventory/dynamic_inventory.py @@ -19,21 +19,14 @@ import argparse import datetime import hashlib import json +import netaddr import os import Queue import random import tarfile import uuid +import yaml -try: - import yaml -except ImportError: - print('Missing Dependency, "PyYAML"') - -try: - import netaddr -except ImportError: - print('Missing Dependency, "netaddr"') USED_IPS = [] INVENTORY_SKEL = {