Skip to content

Commit 311053b

Browse files
Avoid printing confusing log entry when image version doesn't exist (#5060) (#3497)
Signed-off-by: Modular Magician <[email protected]>
1 parent 4d4c980 commit 311053b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changelog/5060.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
Avoid printing confusing (Compsoer version didn't match regexp) log entry when version is empty.
3+
```

google-beta/resource_composer_environment.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,14 +1608,18 @@ func composerImageVersionDiffSuppress(_, old, new string, _ *schema.ResourceData
16081608
// Somehow one of the versions didn't match the regexp or didn't
16091609
// have values in the capturing groups. In that case, fall back to
16101610
// an equality check.
1611-
log.Printf("[WARN] Composer version didn't match regexp: %s", old)
1611+
if old != "" {
1612+
log.Printf("[WARN] Composer version didn't match regexp: %s", old)
1613+
}
16121614
return old == new
16131615
}
16141616
if newVersions == nil || len(newVersions) < 3 {
16151617
// Somehow one of the versions didn't match the regexp or didn't
16161618
// have values in the capturing groups. In that case, fall back to
16171619
// an equality check.
1618-
log.Printf("[WARN] Composer version didn't match regexp: %s", new)
1620+
if new != "" {
1621+
log.Printf("[WARN] Composer version didn't match regexp: %s", new)
1622+
}
16191623
return old == new
16201624
}
16211625

0 commit comments

Comments
 (0)