From 78e81b29657b4d34425a455d512ed6c63dc3133d Mon Sep 17 00:00:00 2001 From: Wojciech Wypior Date: Wed, 2 Jan 2019 20:10:51 +0100 Subject: [PATCH] fixed a bug in transform_name (#50213) --- lib/ansible/module_utils/network/f5/common.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/network/f5/common.py b/lib/ansible/module_utils/network/f5/common.py index 61774a33f1b..d1c3b5c2847 100644 --- a/lib/ansible/module_utils/network/f5/common.py +++ b/lib/ansible/module_utils/network/f5/common.py @@ -325,10 +325,19 @@ def is_valid_fqdn(host): def transform_name(partition='', name='', sub_path=''): + if partition != '': + if name.startswith(partition + '/'): + name = name.replace(partition + '/', '') + if name.startswith('/' + partition + '/'): + name = name.replace('/' + partition + '/', '') + if name: name = name.replace('/', '~') + if partition: - partition = '~' + partition + partition = partition.replace('/', '~') + if not partition.startswith('~'): + partition = '~' + partition else: if sub_path: raise F5ModuleError(