Hammer should validate that --id options aren't blank
|Target version:||Foreman - Team Marek backlog|
|Found in release:||Pull request:|
|Velocity based estimate||-|
This is the error printed when an deleting an architecture and giving it an id that does not exist
[root@host ~]# hammer -u admin architecture delete --id="-1" Could not delete the architecture: Resource architecture not found by id '-1'
However, it seems when an empty string is used it prints a HTTP error
[root@host ~]# hammer -u admin architecture delete --id="" Could not delete the architecture: 404 Resource Not Found
#2 Updated by Tomáš Strachota 12 months ago
- Subject changed from "404 Resource Not Found" printed while doing deleting architecture with id "" to Hammer should validate that --id options aren't blank
- Target version set to Team Marek backlog
The messages appear inconsistent. They're different because it's two types of failures. In the first case hammer tries to fetch non-existent resource form the server, it get correct response and prints the message. In the second case hammer passes blank id for building the url and hits DELETE /architectures/ that doesn't exist. So from the server's point of view the response is correct too but hammer could detect that much earlier because it doesn't make sense to use blank id. Also other commands suffer from this issue:
> hammer host delete --id="" Could not delete the host: 404 Resource Not Found
Therefore the correct fix should be adding a validation for all --id options and checking for non-blank values. I'm changing the subject to make the issue more generic.