Project

General

Profile

Actions

Bug #16306

open

Hammer should validate that --id options aren't blank

Added by Perry Gagne over 7 years ago. Updated over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Hammer core
Target version:
-
Difficulty:
Triaged:
Yes
Team Backlog:
Marek
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

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

Actions #1

Updated by Perry Gagne over 7 years ago

I think the fix here for it do to print a message that indicates the id is invalid or does not exist.

Actions #2

Updated by Tomáš Strachota over 7 years 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 115

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.

Actions #3

Updated by Oleh Fedorenko over 4 years ago

  • Triaged set to Yes
Actions

Also available in: Atom PDF