Skip to content

Commit

Permalink
PMM-13007 stop pmm-agent right after package upgrade. (#2905)
Browse files Browse the repository at this point in the history
* PMM-13007 stop pmm-agent right after package upgrade.

* PMM-7 use ReplaceAll instead of Replace.

(cherry picked from commit 927c2d1)
  • Loading branch information
BupycHuk committed Mar 18, 2024
1 parent 2eae13b commit 9d520d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions managed/services/grafana/auth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,8 @@ func cleanPath(p string) (string, error) {

cleanedPath := path.Clean(unescaped)

cleanedPath = strings.ReplaceAll(cleanedPath, "\n", " ")

u, err := url.Parse(cleanedPath)
if err != nil {
return "", err
Expand Down
3 changes: 3 additions & 0 deletions managed/services/grafana/auth_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ func Test_cleanPath(t *testing.T) {
}, {
"/v1/AWSInstanceCheck/..%2f..%2f/logs.zip",
"/logs.zip",
}, {
"/graph/api/datasources/proxy/8/?query=WITH%20(%0A%20%20%20%20CASE%20%0A%20%20%20%20%20%20%20%20WHEN%20(3000%20%25%2060)%20%3D%200%20THEN%203000%0A%20%20%20%20ELSE%2060%20END%0A)%20AS%20scale%0ASELECT%0A%20%20%20%20(intDiv(toUInt32(timestamp)%2C%203000)%20*%203000)%20*%201000%20as%20t%2C%0A%20%20%20%20hostname%20h%2C%0A%20%20%20%20status%20s%2C%0A%20%20%20%20SUM(req_count)%20as%20req_count%0AFROM%20pinba.report_by_all%0AWHERE%0A%20%20%20%20timestamp%20%3E%3D%20toDateTime(1707139680)%20AND%20timestamp%20%3C%3D%20toDateTime(1707312480)%0A%20%20%20%20AND%20status%20%3E%3D%20400%0A%20%20%20%20AND%20CASE%20WHEN%20%27all%27%20%3C%3E%20%27all%27%20THEN%20schema%20%3D%20%27all%27%20ELSE%201%20END%0A%20%20%20%20AND%20CASE%20WHEN%20%27all%27%20%3C%3E%20%27all%27%20THEN%20hostname%20%3D%20%27all%27%20ELSE%201%20END%0A%20%20%20%20AND%20CASE%20WHEN%20%27all%27%20%3C%3E%20%27all%27%20THEN%20server_name%20%3D%20%27all%27%20ELSE%201%20END%0AGROUP%20BY%20t%2C%20h%2C%20s%0AORDER%20BY%20t%20FORMAT%20JSON",
"/graph/api/datasources/proxy/8/",
},
}
for _, tt := range tests {
Expand Down
16 changes: 7 additions & 9 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@
path: /etc/supervisord.d/supervisord.ini
when: not is_docker

- name: Stop systemd pmm-agent service, if running
systemd:
name: pmm-agent
state: stopped
enabled: no
when: not is_docker

- name: Create grafana config
include_role:
name: grafana
Expand Down Expand Up @@ -304,15 +311,6 @@
include_role:
name: clickhouse

# Fix things that should be fixed before restarts.

- name: Stop systemd pmm-agent service, if running
systemd:
name: pmm-agent
state: stopped
enabled: no
when: not is_docker

# https://jira.percona.com/browse/PMM-9298
- name: Copy rezise-xfs file for lvm
copy:
Expand Down

0 comments on commit 9d520d6

Please sign in to comment.