diff options
author | Jeffrey Zhang <zhang.lei.fly@gmail.com> | 2018-05-26 23:32:12 +0800 |
---|---|---|
committer | Monty Taylor <mordred@redhat.com> | 2018-05-26 08:32:12 -0700 |
commit | f488d3cf79767482e9e07ef23215a6058f7722fc (patch) | |
tree | 684224637a5a04fbfcfb88208d5340cfe2b6927f /lib | |
parent | 78023e79d75ca98cf76c2ff24fae517c4a2d8da5 (diff) | |
download | ansible-f488d3cf79767482e9e07ef23215a6058f7722fc.tar.gz |
Fail with more meaningful message when the volume can not be found (#37508)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/modules/cloud/openstack/os_server_volume.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/modules/cloud/openstack/os_server_volume.py b/lib/ansible/modules/cloud/openstack/os_server_volume.py index 5191115538..ded0b5c9c3 100644 --- a/lib/ansible/modules/cloud/openstack/os_server_volume.py +++ b/lib/ansible/modules/cloud/openstack/os_server_volume.py @@ -100,6 +100,10 @@ def main(): try: server = cloud.get_server(module.params['server']) volume = cloud.get_volume(module.params['volume']) + + if not volume: + module.fail_json(msg='volume %s is not found' % module.params['volume']) + dev = cloud.get_volume_attach_device(volume, server.id) if module.check_mode: |