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

migrator: Set migrations executable before running #561

Merged
merged 1 commit into from
Nov 22, 2019

Conversation

etungsten
Copy link
Contributor

@etungsten etungsten commented Nov 22, 2019

Issue #, if available: Fixes #558

Description of changes:
Make migration binaries executable before migrator runs them.

Testing done:
On a live Thar instance, copied over migration binaries. They are initially not executable. Ran migrator, migrations got applied and confirmed that the migration binaries are now executable.

bash-5.0# ls -al
total 1048
drwxr-xr-x 2 root root   4096 Nov 22 22:05 .
drwxr-xr-x 7 root root   4096 Nov 22 22:04 ..
-rw-rw-r-- 1 1000 1000 547296 Nov 22 22:05 migrate_v0.1_borkseed
-rw-rw-r-- 1 1000 1000 514528 Nov 22 21:58 migrate_v0.1_host-containers
bash-5.0# migrator --datastore-path /var/lib/thar/datastore/current --log-level debug --migrate-to-version 0.1 --migration-directories /var/lib/thar/datasto>
22:06:12 [ INFO] Found applicable forward migration 'migrate_v0.1_host-containers': v0.0 < (v0.1) <= v0.1
22:06:12 [ INFO] Found applicable forward migration 'migrate_v0.1_borkseed': v0.0 < (v0.1) <= v0.1
22:06:12 [DEBUG] (1) migrator: Sorted migrations: ["migrate_v0.1_borkseed", "migrate_v0.1_host-containers"]
22:06:12 [ INFO] Copying datastore from /var/lib/thar/datastore/v0.0_RRzPF5ak52eVHa3B to work location /var/lib/thar/datastore/v0.1_qwNcks1TZIf5ideX
22:06:12 [ INFO] Running migration command: "/var/lib/thar/datastore/migrations/migrate_v0.1_borkseed" "--forward" "--datastore-path" "/var/lib/thar/datastore/v0.1_qwNcks1TZIf5ideX"
22:06:12 [ INFO] Running migration command: "/var/lib/thar/datastore/migrations/migrate_v0.1_host-containers" "--forward" "--datastore-path" "/var/lib/thar/datastore/v0.1_qwNcks1TZIf5ideX"
22:06:12 [ INFO] Flipping /var/lib/thar/datastore/v0.1 to point to v0.1_qwNcks1TZIf5ideX
22:06:12 [ INFO] Flipping /var/lib/thar/datastore/v0 to point to v0.1
bash-5.0# cat /var/lib/thar/datastore/current/live/settings/updates/seed
1808
bash-5.0# migrator --datastore-path /var/lib/thar/datastore/current --log-level debug --migrate-to-version 0.0 --migration-directories /var/lib/thar/datasto>
22:06:21 [ INFO] Found applicable backward migration 'migrate_v0.1_host-containers': v0.1 >= (v0.1) > v0.0
22:06:21 [ INFO] Found applicable backward migration 'migrate_v0.1_borkseed': v0.1 >= (v0.1) > v0.0
22:06:21 [DEBUG] (1) migrator: Sorted migrations: ["migrate_v0.1_host-containers", "migrate_v0.1_borkseed"]
22:06:21 [ INFO] Copying datastore from /var/lib/thar/datastore/v0.1_qwNcks1TZIf5ideX to work location /var/lib/thar/datastore/v0.0_KTsOCeOXcFzeoVYl
22:06:21 [ INFO] Running migration command: "/var/lib/thar/datastore/migrations/migrate_v0.1_host-containers" "--backward" "--datastore-path" "/var/lib/thar/datastore/v0.0_KTsOCeOXcFzeoVYl"
22:06:21 [ INFO] Running migration command: "/var/lib/thar/datastore/migrations/migrate_v0.1_borkseed" "--backward" "--datastore-path" "/var/lib/thar/datastore/v0.0_KTsOCeOXcFzeoVYl"
22:06:21 [ INFO] Flipping /var/lib/thar/datastore/v0.0 to point to v0.0_KTsOCeOXcFzeoVYl
22:06:21 [ INFO] Flipping /var/lib/thar/datastore/v0 to point to v0.0
bash-5.0# cat /var/lib/thar/datastore/current/live/settings/updates/seed
"1808"
bash-5.0# ls -al
total 1048
drwxr-xr-x 2 root root   4096 Nov 22 22:05 .
drwxr-xr-x 9 root root   4096 Nov 22 22:06 ..
-rwxr-xr-x 1 1000 1000 547296 Nov 22 22:05 migrate_v0.1_borkseed
-rwxr-xr-x 1 1000 1000 514528 Nov 22 21:58 migrate_v0.1_host-containers

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@tjkirch tjkirch left a comment

Choose a reason for hiding this comment

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

I think we should remove this when no longer needed as a workaround for updog. We may be running not as root, against migrations we don't own, when data store permissions changes are in place.

@etungsten etungsten merged commit af524a1 into develop Nov 22, 2019
@etungsten etungsten deleted the migrator-chmod branch November 22, 2019 22:41
@iliana iliana added this to the v0.2.0 milestone Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[updog] Migration snafu's (unable to run migrations)
3 participants