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

[CDF-21667] 😮fix: error message on wrong version #629

Merged
merged 4 commits into from
Jun 10, 2024
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
2 changes: 1 addition & 1 deletion cognite_toolkit/_cdf_tk/_migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
cognite_modules: {}
resources: {}
tool:
- title: "Function config YAML files must be in the function directori"
- title: "Function config YAML files must be in the function directory"
steps:
- Before functions config YAML files were allowed in subdirectories of the function directory. For example,
`functions/my_function/my_function.yaml` was allowed. This is no longer supported. The function config YAML
Expand Down
10 changes: 5 additions & 5 deletions cognite_toolkit/_cdf_tk/data_classes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ def _load_version_variable(data: dict[str, Any], file_name: str) -> str:
err_msg = f"System variables are missing required field 'cdf_toolkit_version' in {file_name!s}. {{}}"
if file_name == BUILD_ENVIRONMENT_FILE:
raise ToolkitVersionError(
err_msg.format("Rerun `cdf-tk build` to build the templates again and create it correctly.")
err_msg.format("Rerun `cdf-tk build` to build the modules again and create it correctly.")
)
raise ToolkitVersionError(
err_msg.format("Run `cdf-tk init --upgrade` to initialize the templates again to create a correct file.")
err_msg.format("Run `cdf-tk init --upgrade` to initialize the modules again to create a correct file.")
)

if cdf_tk_version != _version.__version__:
raise ToolkitVersionError(
"The version of the templates ({cdf_tk_version}) does not match the version of the installed package "
f"({_version.__version__}). Please either run `cdf-tk init --upgrade` to upgrade the templates OR "
f"run `pip install cognite-toolkit=={cdf_tk_version}` to downgrade cdf-tk."
f"The version of the modules ({cdf_tk_version}) does not match the version of the installed CLI "
f"({_version.__version__}). Please either run `cdf-tk init --upgrade` to upgrade the modules OR "
f"run `pip install cognite-toolkit=={cdf_tk_version}` to downgrade cdf-tk CLI."
)
return cdf_tk_version
4 changes: 2 additions & 2 deletions cognite_toolkit/_cdf_tk/data_classes/_migration_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ def as_one_change(self) -> VersionChanges:
# This is a simple convinced to print the content of ../_migration.yaml
# to the console. It is not used in the toolkit itself, but can be used
# in the development of the toolkit.
m = MigrationYAML.load_from_version("0.1.4")
m.print(Path(__file__).parent.parent, "0.1.4")
m = MigrationYAML.load_from_version("0.2.b3")
m.print(Path(__file__).parent.parent, "0.3.b3")
Loading