mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Allow escaped comments in inventory files.
This commit is contained in:
parent
4e8ed92130
commit
94a7fb60fe
3 changed files with 34 additions and 1 deletions
|
@ -1071,3 +1071,12 @@ def random_password(length=20, chars=C.DEFAULT_PASSWORD_CHARS):
|
|||
password.append(new_char)
|
||||
|
||||
return ''.join(password)
|
||||
|
||||
def before_comment(msg):
|
||||
''' what's the part of a string before a comment? '''
|
||||
msg = msg.replace("\#","**NOT_A_COMMENT**")
|
||||
msg = msg.split("#")[0]
|
||||
msg = msg.replace("**NOT_A_COMMENT**","#")
|
||||
return msg
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue