From: spisarski Date: Mon, 17 Jul 2017 16:21:02 +0000 (-0600) Subject: Created new class AnsibleException. X-Git-Tag: opnfv-5.0.0~62^2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F41%2F37641%2F1;p=snaps.git Created new class AnsibleException. Raising AnsibleException in ansible_utils.py instead of Exception. JIRA: SNAPS-130 Change-Id: I72d7ea3779c9644559ae7dc4dbb26edc4da20594 Signed-off-by: spisarski --- diff --git a/snaps/provisioning/ansible_utils.py b/snaps/provisioning/ansible_utils.py index b776ba0..aa1de9b 100644 --- a/snaps/provisioning/ansible_utils.py +++ b/snaps/provisioning/ansible_utils.py @@ -48,11 +48,11 @@ def apply_playbook(playbook_path, hosts_inv, host_user, ssh_priv_key_file_path, :return: the results """ if not os.path.isfile(playbook_path): - raise Exception('Requested playbook not found - ' + playbook_path) + raise AnsibleException('Requested playbook not found - ' + playbook_path) pk_file_path = os.path.expanduser(ssh_priv_key_file_path) if not os.path.isfile(pk_file_path): - raise Exception('Requested private SSH key not found - ' + + raise AnsibleException('Requested private SSH key not found - ' + pk_file_path) import ansible.constants @@ -126,3 +126,9 @@ def ssh_client(ip, user, private_key_filepath, proxy_settings=None): return ssh except Exception as e: logger.warning('Unable to connect via SSH with message - ' + str(e)) + + +class AnsibleException(Exception): + """ + Exception when calls to the Keystone client cannot be served properly + """