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

chore: logging improvement for invalid configuration #1319

Merged
merged 1 commit into from
Dec 8, 2022

Conversation

IronCore864
Copy link
Member

Signed-off-by: Tiexin Guo guotiexin@gmail.com

Pre-Checklist

Note: please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests

Description

1 Wrong Config

Config:

asdf

Original behaviour:

tiexin@mbp ~/work/devstream-io/devstream $ ./dtm apply
2022-12-08 11:15:00 ℹ [INFO]  Apply started.
2022-12-08 11:15:00 !! [ERROR]  Apply failed => configmanager can't found valid [config], please check your config file.

After fix:

tiexin@mbp ~/work/devstream-io/devstream $ ./dtm apply
2022-12-08 11:27:27 ℹ [INFO]  Apply started.
2022-12-08 11:27:27 !! [ERROR]  Apply failed => config not valid; check the [config] section of your config file.
2022-12-08 11:27:27 ℹ [INFO]  It seems your config file is not valid. Please check the official documentation https://docs.devstream.io, or use the "dtm show config" command to get an example.

2 Missing Variable Definition

Config:

config:
  state:
    backend: local
    options:
      stateFile: devstream.state

tools:
- name: repo-scaffolding
  instanceID: myapp
  options:
    vars:
      imageRepo: [[ dockerUser ]]/[[ app ]]

Original behaviour:

tiexin@mbp ~/work/devstream-io/devstream $ ./dtm apply
2022-12-08 11:30:52 ℹ [INFO]  Apply started.
2022-12-08 11:30:52 !! [ERROR]  Apply failed => failed to get tools from config file. Error: template:
- name: repo-scaffolding
  instanceID: myapp
  options:
    vars:
      imageRepo: [[ dockerUser ]]/[[ app ]]
:6:20: executing "\n- name: repo-scaffolding\n  instanceID: myapp\n  options:\n    vars:\n      imageRepo: [[ dockerUser ]]/[[ app ]]\n" at <.dockerUser>: map has no entry for key "dockerUser".

After fix:

tiexin@mbp ~/work/devstream-io/devstream $ ./dtm apply
2022-12-08 11:44:30 ℹ [INFO]  Apply started.
2022-12-08 11:44:30 !! [ERROR]  Apply failed => failed to process variables in the tools section. Missing variable definition: "dockerUser".

Signed-off-by: Tiexin Guo <guotiexin@gmail.com>
@IronCore864 IronCore864 requested a review from a team as a code owner December 8, 2022 03:49
@daniel-hutao daniel-hutao self-requested a review December 8, 2022 12:51
@daniel-hutao daniel-hutao merged commit e831f25 into main Dec 8, 2022
@daniel-hutao daniel-hutao deleted the logging-improvement branch December 8, 2022 12:51
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.

3 participants