diff options
author | 2017-07-18 13:48:30 +0000 | |
---|---|---|
committer | 2017-07-18 13:48:30 +0000 | |
commit | f2fc55fc622b57c078615d847443023fea0799e2 (patch) | |
tree | c5c5ee1289d23e84876bfd6e3e03e5239ba1491e | |
parent | 2d08ff42b777b5b0e0f7c82c32919834ae633382 (diff) | |
parent | 63717e56f6dd988cc997f9746adf575096052fa8 (diff) |
Merge "Created new class AnsibleException."
-rw-r--r-- | snaps/provisioning/ansible_utils.py | 10 |
1 files changed, 8 insertions, 2 deletions
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 + """ |