mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed a bug in transform_name (#50213)
This commit is contained in:
parent
4d6807a6b0
commit
78e81b2965
1 changed files with 10 additions and 1 deletions
|
@ -325,9 +325,18 @@ 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.replace('/', '~')
|
||||
if not partition.startswith('~'):
|
||||
partition = '~' + partition
|
||||
else:
|
||||
if sub_path:
|
||||
|
|
Loading…
Reference in a new issue