some logging
continuous-integration/drone/push Build is failing Details

pull/11/head
Inex Code 2022-04-29 14:24:25 +03:00
parent f2c73853bc
commit ac220c6968
1 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,7 @@ from selfprivacy_api.migrations.migration import Migration
class MigrateToSelfprivacyChannel(Migration):
"""Migrate to selfprivacy Nix channel."""
def get_migration_name(self):
return "migrate_to_selfprivacy_channel"
@ -13,11 +14,14 @@ class MigrateToSelfprivacyChannel(Migration):
def is_migration_needed(self):
try:
print("Checking if migration is needed")
output = subprocess.check_output(
["nix-channel", "--list"], start_new_session=True
)
output = output.decode("utf-8")
print(output)
first_line = output.split("\n", maxsplit=1)[0]
print(first_line)
return first_line.startswith("nixos") and (
first_line.endswith("nixos-21.11") or first_line.endswith("nixos-21.05")
)
@ -30,6 +34,7 @@ class MigrateToSelfprivacyChannel(Migration):
# Also, go to /etc/nixos directory and make a git pull
current_working_directory = os.getcwd()
try:
print("Changing channel")
os.chdir("/etc/nixos")
subprocess.check_output(
[