# Buggy code
def prepare(cls, params):
    # Build fake profile because we don't have it in the DB yet.
    profile = FakeProfile(
        FakeRepo(params["repo_url"], 999, params["extra_borg_arguments"]),
        "Init Repo",
        params["ssh_key"],
    )

    ret = super().prepare(profile)
    if not ret["ok"]:
        return ret
    else:
        ret["ok"] = False  # Set back to false, so we can do our own checks here.

    cmd = ["borg", "init", "--info", "--log-json"]
    cmd.append(f"--encryption={params['encryption']}")
    cmd.append(params["repo_url"])

    ret["additional_env"] = {"BORG_RSH": "ssh -oStrictHostKeyChecking=no"}

    ret["encryption"] = params["encryption"]
    ret["password"] = params["password"]
    ret["ok"] = True
    ret["cmd"] = cmd

    return ret


# Traceback (dbus.exceptions.DBusException)
2020-08-31 20:53:34,066 - vorta.borg.borg_thread - DEBUG - Using VortaSecretStorageKeyring keyring to store passwords.
2020-08-31 20:53:34,066 - asyncio - DEBUG - Using selector: EpollSelector
Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/vorta/views/repo_add_dialog.py", line 64, in run
params = BorgInitThread.prepare(self.values)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/init.py", line 20, in prepare
ret = super().prepare(profile)
File "/home/user/.local/lib/python3.8/site-packages/vorta/borg/borg_thread.py", line 121, in prepare
ret['password'] = keyring.get_password('vorta-repo', profile.repo.url)
File "/home/user/.local/lib/python3.8/site-packages/vorta/keyring/secretstorage.py", line 30, in get_password
collection = secretstorage.get_default_collection(self.connection)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 155, in get_default_collection
return Collection(bus)
File "/usr/lib/python3/dist-packages/secretstorage/collection.py", line 42, in __init__
self.collection_props_iface.Get(COLLECTION_IFACE, 'Label',
File "/usr/lib/python3/dist-packages/secretstorage/util.py", line 31, in function_out
return function_in(*args, **kwargs)
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: No such object path '/org/freedesktop/secrets/aliases/default'

# Fixed code
def prepare(cls, params):
    # Build fake profile because we don't have it in the DB yet.
    profile = FakeProfile(
        FakeRepo(
            params["repo_url"],
            999,
            params["extra_borg_arguments"],
            params["encryption"],
        ),
        "Init Repo",
        params["ssh_key"],
    )

    ret = super().prepare(profile)
    if not ret["ok"]:
        return ret
    else:
        ret["ok"] = False  # Set back to false, so we can do our own checks here.

    cmd = ["borg", "init", "--info", "--log-json"]
    cmd.append(f"--encryption={params['encryption']}")
    cmd.append(params["repo_url"])

    ret["additional_env"] = {"BORG_RSH": "ssh -oStrictHostKeyChecking=no"}

    ret["encryption"] = params["encryption"]
    ret["password"] = params["password"]
    ret["ok"] = True
    ret["cmd"] = cmd

    return ret