Skip to content
This repository was archived by the owner on May 31, 2023. It is now read-only.

Commit 6ddde72

Browse files
author
Jesse Pretorius
committed
Update datasource regex match to include dashes and numbers
In order to match datasources like "DS_DML-PROM0" which include dashes and numbers, we open the match to include them. We also remove the capture groups implemented in [1] as they're not required and their inclusion makes things more difficult to understand. Instead, we provide the same function by simply also allowing underscores in the match. [1] #53 Fixes #59
1 parent 6f4b96c commit 6ddde72

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tasks/dashboards.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@
4747
# 2. Non-capturing optional group matches for the ${} bits which may, or
4848
# or may not, be there..
4949
# 3. A case-sensitive literal match for DS .
50-
# 4. One or more case-sensitive matches for groups of alphabetical characters
51-
# where each group is preceded by an underscore.
50+
# 4. A one-or-more case-sensitive match for the part that follows the
51+
# underscore, with only A-Z, 0-9 and - or _ allowed.
5252
#
5353
# This regex can be tested and understood better by looking at the
54-
# matches and non-matches in https://regex101.com/r/f4Gkvg/4
54+
# matches and non-matches in https://regex101.com/r/f4Gkvg/6
5555

5656
- name: Set the correct data source name in the dashboard
5757
become: false
5858
replace:
5959
dest: "/tmp/dashboards/{{ item.dashboard_id }}.json"
60-
regexp: '"(?:\${)?DS(_([A-Z])+)+(?:})?"'
60+
regexp: '"(?:\${)?DS_[A-Z0-9_-]+(?:})?"'
6161
replace: '"{{ item.datasource }}"'
6262
delegate_to: localhost
6363
run_once: true

0 commit comments

Comments
 (0)