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

544 client files are not migrated on spinta start #545

Merged
merged 1 commit into from
Nov 21, 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
4 changes: 1 addition & 3 deletions spinta/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,8 @@ def create_client_file_name_id_mapping(path: pathlib.Path):
yml.dump(keymap, keymap_path)


def handle_auth_client_files(context: Context):
config = context.get('config')
def handle_auth_client_files(config: Config):
path = get_clients_path(config)

if path.exists():
if not (path / 'id').exists():
items = os.listdir(path)
Expand Down
3 changes: 1 addition & 2 deletions spinta/cli/helpers/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import click

from spinta import commands
from spinta.auth import auth_server_keys_exists, handle_auth_client_files, client_name_exists, get_clients_path
from spinta.auth import auth_server_keys_exists, client_name_exists, get_clients_path
from spinta.auth import create_client_file
from spinta.auth import gen_auth_server_keys
from spinta.components import Config
Expand Down Expand Up @@ -62,7 +62,6 @@ def load_config(
) -> Config:
config = context.get('config')
commands.load(context, config)
handle_auth_client_files(context)
if ensure_config_dir:
_ensure_config_dir(
config,
Expand Down
4 changes: 3 additions & 1 deletion spinta/types/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ruamel.yaml import YAML

from spinta.auth import client_name_exists, get_clients_path
from spinta.auth import client_name_exists, get_clients_path, handle_auth_client_files
from spinta.formats.components import Format
from spinta.core.config import DEFAULT_CONFIG_PATH
from spinta.core.config import DEFAULT_DATA_PATH
Expand Down Expand Up @@ -96,6 +96,8 @@ def load(context: Context, config: Config) -> Config:
"Configuration option `mode` must be added to a manifest, now it "
"is added to the config root."
)
# Ensure that client filed were migrated
handle_auth_client_files(config)

return config

Expand Down
Loading