-
Notifications
You must be signed in to change notification settings - Fork 94
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
Make --dry-run an actual dry-run #1129
Comments
Hi @STgversluis. You're correct that dry-run only validates configuration file syntax. Providing a full validation that connects to the environment is already on our internal roadmap, though at this point we can not provide any ETA for this feature. To you other notes on expected behaviour: the CLI has no way of identifying how a token is incorrect, as it can only work on what error information returned by the Dynatrace API. (401 Unauthorized HTTP) I hope that helps a bit. I will leave this github issue open to allow others to find this question/answer in the future. |
Hi @UnseenWizzard , I don't agree on your statement that the documentation is clear about a dry-run only checking syntax. The documentation leaves out that no actual connection is made and the confusing log lines make things worse. As you state the CLI behaviour is a response to 401 Unauthorized HTTP. Why not start those log lines with something like "The authentication failed. Please check the token in ." and then continue with "Other possible causes: You may be using an old token format or connecting to a Dynatrace environment that is not on a recent version." (please note I mentioned may be using an old token format, not "You used an old token format" which is an incorrect statement of fact.) From my POV (not knowing the inner workings of the CLI or the workload of the development team) this shouldn't be too complex, and it would have saved both me and Dynatrace Support quite some time. |
Thanks for the feedback @STgversluis! |
Hi @STgversluis, after taking another look at the logs you're seeing in this case, I don't see your suggestion as different from what is already being logged? One (technical) note on the logs just to clarify the cause: The token format warning happens as soon as your token is loaded but has no relation to whether this token is valid for the Dynatrace environment. It's just a hint that you could create a newer one with more fine grained options. (Note that Dynatrace 1.205 is nearly 3 years old.) 2023-08-18T12:21:39+02:00 warn You used an old token format. Please consider switching to the new 1.205+ token format.
More information: https://www.dynatrace.com/support/help/dynatrace-api/basics/dynatrace-api-authentication We'll extend the authentication error with a note to check if the token is correct. 2023-08-18T12:21:39+02:00 error Could not authorize against the environment with name "test" (https://dynatrace.europe.stater.corp/e/test) using token authorization: failed to query version of Dynatrace environment: (HTTP 401) Response was: {"error":{"code":401,"message":"Token Authentication failed"}}
2023-08-18T12:21:39+02:00 error Please verify that this environment is a Dynatrace Classic environment. Would that cover what you had in mind, or am I missing something here? edit: taking another look at the token format check, I see how it is misleading! Technically the CLI checks whether the token matches the new format, not that it's an old one. |
Hi @UnseenWizzard , I was using a new style token - actually, I took the valid token and only changed the last letter of that from an A to a B. IMO, that doesn't do anything with regards to the new format - it should still match. And is there a way to check the version, even without a token? That way you'd be able to rule out old style environments. I can even imagine changing the 401 response to include something in the newer version... wouldn't change anything for the current stuff obviously, but would be helpful in the future. Regards, Gerald |
Hi @STgversluis. We've just released v2.7.1 which aims to improve that warning, now printing:
There is sadly no way to reliably verify a Dynatrace environment's "generation" (which is where you're seeing the 401 Unauthorized) other than connecting to its API, which always requires valid credentials/tokens. |
Describe the bug
The term dry-run suggests that apart from actually applying the config, everything is tested. However, this is not the case.
After a lot of time spent troubleshooting together with Dynatrace support (case #172865), we came to the conclusion that the dry-run only runs a syntax check. It does not connect to the actual tenant, it does not check for conflicting settings, it does not verify the token… which means it leaves plenty of opportunity for disaster when someone makes a wrong change.
How to reproduce
Perform a dry-run known to result in an error, such as:
Expected behavior
Log output
Output from dry-run:
2023-08-18T12:20:20+02:00 info Validation finished without errors
Output from download, with same env var value for token:
2023-08-18T12:21:39+02:00 info Loading manifest "manifest.yaml". Restrictions: groups=[], environments=["test"]
2023-08-18T12:21:39+02:00 warn You used an old token format. Please consider switching to the new 1.205+ token format.
More information: https://www.dynatrace.com/support/help/dynatrace-api/basics/dynatrace-api-authentication
2023-08-18T12:21:39+02:00 error Could not authorize against the environment with name "test" (https://dynatrace.europe.stater.corp/e/test) using token authorization: failed to query version of Dynatrace environment: (HTTP 401) Response was: {"error":{"code":401,"message":"Token Authentication failed"}}
2023-08-18T12:21:39+02:00 error Please verify that this environment is a Dynatrace Classic environment.
Environment (please complete the following information):
Additional context
none.
The text was updated successfully, but these errors were encountered: