Skip to content

Commit

Permalink
switched to 're' to handle both cases of quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
dericcrago committed Mar 8, 2021
1 parent d586deb commit 259159d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugins/modules/network/cumulus/nclu.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
sample: "interface bond0 config updated"
'''

import re
from ansible.module_utils.basic import AnsibleModule


Expand All @@ -165,10 +166,10 @@ def check_pending(module):
"""Check the pending diff of the nclu buffer."""
pending = command_helper(module, "pending", "Error in pending config. You may want to view `net pending` on this target.")

delimeter1 = "net add/del commands since the last \"net commit\""
delimeter1 = re.compile('''net add/del commands since the last ['"]net commit['"]''')
color1 = '\x1b[94m'
if delimeter1 in pending:
pending = pending.split(delimeter1)[0]
if re.search(delimeter1, pending):
pending = re.split(delimeter1, pending)[0]
pending = pending.replace(color1, '')
return pending.strip()

Expand Down

0 comments on commit 259159d

Please sign in to comment.