Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Nov 20, 2024
1 parent 4f107e7 commit 427d40f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build/ansible/pmm-docker/init.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# This playbook is run by the `pmm-update` supervisord process
# This playbook is run by the `pmm-init` supervisord process
- hosts: all
become: true
become_method: su
Expand Down
1 change: 1 addition & 0 deletions build/ansible/roles/initialization/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
- name: Upgrade/Install dashboards
include_role:
name: dashboards
when: need_initialization or need_upgrade

- name: Create a backup directory
file:
Expand Down
4 changes: 2 additions & 2 deletions build/ansible/roles/pmm-images/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@
register: managed_init_result
changed_when: True

- name: Disable pmm-update
- name: Disable pmm-init
ini_file:
path: /etc/supervisord.d/pmm.ini
section: program:pmm-update
section: program:pmm-init
option: autostart
value: "false"

Expand Down
2 changes: 1 addition & 1 deletion build/ansible/roles/supervisord/files/pmm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ username = dummy
password = dummy

; we rewrite autostart to true during update or build.
[program:pmm-update]
[program:pmm-init]
command = /usr/bin/ansible-playbook /opt/ansible/pmm-docker/init.yml
user = pmm
directory = /
Expand Down
36 changes: 18 additions & 18 deletions managed/services/supervisord/maintail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ func TestParseEvent(t *testing.T) {
t.Parallel()

log := strings.Split(`
2019-08-09 09:18:25,667 INFO spawned: 'pmm-update' with pid 11410
2019-08-09 09:18:26,539 INFO exited: pmm-update (exit status 0; not expected)
2019-08-09 09:18:27,543 INFO spawned: 'pmm-update' with pid 11421
2019-08-09 09:18:28,324 INFO exited: pmm-update (exit status 0; not expected)
2019-08-09 09:18:30,335 INFO spawned: 'pmm-update' with pid 11432
2019-08-09 09:18:31,109 INFO exited: pmm-update (exit status 0; not expected)
2019-08-09 09:18:34,119 INFO spawned: 'pmm-update' with pid 11443
2019-08-09 09:18:34,883 INFO exited: pmm-update (exit status 0; not expected)
2019-08-09 09:18:35,885 INFO gave up: pmm-update entered FATAL state, too many start retries too quickly
2019-08-09 09:18:25,667 INFO spawned: 'pmm-init' with pid 11410
2019-08-09 09:18:26,539 INFO exited: pmm-init (exit status 0; not expected)
2019-08-09 09:18:27,543 INFO spawned: 'pmm-init' with pid 11421
2019-08-09 09:18:28,324 INFO exited: pmm-init (exit status 0; not expected)
2019-08-09 09:18:30,335 INFO spawned: 'pmm-init' with pid 11432
2019-08-09 09:18:31,109 INFO exited: pmm-init (exit status 0; not expected)
2019-08-09 09:18:34,119 INFO spawned: 'pmm-init' with pid 11443
2019-08-09 09:18:34,883 INFO exited: pmm-init (exit status 0; not expected)
2019-08-09 09:18:35,885 INFO gave up: pmm-init entered FATAL state, too many start retries too quickly
`, "\n")

var actual []*event
Expand All @@ -92,15 +92,15 @@ func TestParseEvent(t *testing.T) {
}
}
expected := []*event{
{Time: time.Date(2019, 8, 9, 9, 18, 25, 667000000, time.UTC), Type: starting, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 26, 539000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 27, 543000000, time.UTC), Type: starting, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 28, 324000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 30, 335000000, time.UTC), Type: starting, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 31, 109000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 34, 119000000, time.UTC), Type: starting, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 34, 883000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 35, 885000000, time.UTC), Type: fatal, Program: "pmm-update"},
{Time: time.Date(2019, 8, 9, 9, 18, 25, 667000000, time.UTC), Type: starting, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 26, 539000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 27, 543000000, time.UTC), Type: starting, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 28, 324000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 30, 335000000, time.UTC), Type: starting, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 31, 109000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 34, 119000000, time.UTC), Type: starting, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 34, 883000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"},
{Time: time.Date(2019, 8, 9, 9, 18, 35, 885000000, time.UTC), Type: fatal, Program: "pmm-init"},
}
assert.Equal(t, expected, actual)
})
Expand Down
2 changes: 1 addition & 1 deletion managed/services/supervisord/pmm_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ password = dummy
username = dummy
password = dummy
[program:pmm-update]
[program:pmm-init]
command = /usr/bin/ansible-playbook /opt/ansible/pmm-docker/init.yml
user = pmm
directory = /
Expand Down
4 changes: 2 additions & 2 deletions managed/services/supervisord/supervisord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ func TestParseStatus(t *testing.T) {
for str, expected := range map[string]*bool{
`pmm-agent STOPPED Sep 20 08:55 AM`: pointer.ToBool(false),
`pmm-managed RUNNING pid 826, uptime 0:19:36`: pointer.ToBool(true),
`pmm-update EXITED Sep 20 07:42 AM`: nil,
`pmm-update STARTING`: pointer.ToBool(true), // no last column in that case
`pmm-init EXITED Sep 20 07:42 AM`: nil,
`pmm-init STARTING`: pointer.ToBool(true), // no last column in that case
} {
assert.Equal(t, expected, parseStatus(str), "%q", str)
}
Expand Down
2 changes: 1 addition & 1 deletion managed/testdata/supervisord.d/pmm-db_disabled.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ password = dummy
username = dummy
password = dummy

[program:pmm-update]
[program:pmm-init]
command = /usr/bin/ansible-playbook /opt/ansible/pmm-docker/init.yml
user = pmm
directory = /
Expand Down
2 changes: 1 addition & 1 deletion managed/testdata/supervisord.d/pmm-db_enabled.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ password = dummy
username = dummy
password = dummy

[program:pmm-update]
[program:pmm-init]
command = /usr/bin/ansible-playbook /opt/ansible/pmm-docker/init.yml
user = pmm
directory = /
Expand Down
7 changes: 1 addition & 6 deletions version/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ type PackageInfo struct {
Repo string `json:"repo"`
}

// UpdateInstalledResult represents `pmm-update -installed` result.
type UpdateInstalledResult struct {
Installed PackageInfo `json:"installed"`
}

// UpdateCheckResult represents `pmm-update -check` result.
// UpdateCheckResult describes the latest update check result.
type UpdateCheckResult struct {
Installed PackageInfo `json:"installed"`
Latest DockerVersionInfo `json:"latest,omitempty"`
Expand Down

0 comments on commit 427d40f

Please sign in to comment.