Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-7 fix UI upgrade #2491

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@
state: absent
path: /usr/share/pmm-server/maintenance/maintenance.html
# We use current_version_file['failed'] because we don't want to run this on creating container
when: not ui_upgrade and current_version_file['failed'] == false
when: not ui_upgrade and current_version_file['failed'] == false and not pmm_current_version is version(pmm_image_version, '>=')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
when: not ui_upgrade and current_version_file['failed'] == false and not pmm_current_version is version(pmm_image_version, '>=')
when:
- not ui_upgrade
- current_version_file['failed'] == false
- not pmm_current_version is version(pmm_image_version, '>=')

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not crucial, but much better to read and comprehend



46 changes: 23 additions & 23 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,29 @@
- /etc/yum/yum-cron-hourly.conf
- /etc/yum/yum-cron.conf

- name: Check that the SQLite grafana database exists
stat:
path: /srv/grafana/grafana.db
register: is_database_sqlite

- name: Migrate Grafana database from SQLite to Postgresql
include_role:
name: sqlite-to-postgres
when: is_database_sqlite.stat.exists
tags:
- skip_ansible_lint # '503 Tasks that run when changed should likely be handlers'.

- name: Fix grafana fields type
postgresql_query:
db: grafana
query: "{{ item }}"
loop:
- ALTER TABLE tag ALTER COLUMN key TYPE text;
- ALTER TABLE tag ALTER COLUMN value TYPE text;
- ALTER TABLE api_key ALTER COLUMN key TYPE text;
- ALTER TABLE api_key ALTER COLUMN name TYPE text;
when: not ansible_check_mode

# Regenerating to enable pmm-update-perform-init
- name: Generate new supervisor config
command: pmm-managed-init
Expand Down Expand Up @@ -430,29 +453,6 @@
- name: Print other services's logs
debug: var=update_result.stdout_lines

- name: Check that the SQLite grafana database exists
stat:
path: /srv/grafana/grafana.db
register: is_database_sqlite

- name: Migrate Grafana database from SQLite to Postgresql
include_role:
name: sqlite-to-postgres
when: is_database_sqlite.stat.exists
tags:
- skip_ansible_lint # '503 Tasks that run when changed should likely be handlers'.

- name: Fix grafana fields type
postgresql_query:
db: grafana
query: "{{ item }}"
loop:
- ALTER TABLE tag ALTER COLUMN key TYPE text;
- ALTER TABLE tag ALTER COLUMN value TYPE text;
- ALTER TABLE api_key ALTER COLUMN key TYPE text;
- ALTER TABLE api_key ALTER COLUMN name TYPE text;
when: not ansible_check_mode

- name: Wait for PMM to be ready
ansible.builtin.uri:
url: "http://127.0.0.1:7772/v1/readyz"
Expand Down
Loading