Skip to content

Commit

Permalink
PMM-12266 fix parsing yum date format el9 (2.38.0) (#2327)
Browse files Browse the repository at this point in the history
* PMM-12266 fix parsing yum date format for EL9

* PMM-12266 format code

* PMM-12266 fix a redundant fn variable
  • Loading branch information
Alex Tymchuk authored Jun 29, 2023
1 parent dc0cd38 commit 03d5997
Show file tree
Hide file tree
Showing 4 changed files with 347 additions and 10 deletions.
3 changes: 1 addition & 2 deletions update/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
---
version: '3'
services:
pmm-update-server:
image: ${PMM_SERVER_IMAGE:-percona/pmm-server:2}
container_name: pmm-update-server
environment:
# for tests
- PMM_SERVER_IMAGE=${PMM_SERVER_IMAGE:-percona/pmm-server:2}
- GO_VERSION=${GO_VERSION:-1.17.x}
- GO_VERSION=${GO_VERSION:-1.20.x}
- PATH=/root/go/bin:$PATH
- REVIEWDOG_GITHUB_API_TOKEN=${REVIEWDOG_GITHUB_API_TOKEN}
volumes:
Expand Down
7 changes: 6 additions & 1 deletion update/pkg/yum/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ func parseInfo(lines []string, firstKey string) (map[string]string, error) {
}

func parseInfoTime(s string) (time.Time, error) {
return time.Parse("Mon Jan 2 15:04:05 2006", s)
layout := "Mon 2 Jan 2006 15:04:05 PM UTC" // layout for EL9, default
v, err := getRHELVersion()
if err == nil && v == "7" {
layout = "Mon Jan 2 15:04:05 2006" // change the layout for EL7
}
return time.Parse(layout, s)
}

// fullVersion returns full (ugly) package version.
Expand Down
Loading

0 comments on commit 03d5997

Please sign in to comment.