fixed a bug in transform_name (#50213)

This commit is contained in:
Wojciech Wypior 2019-01-02 20:10:51 +01:00 committed by Tim Rupp
parent 4d6807a6b0
commit 78e81b2965

View file

@ -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(