inex / IXP-Manager

Full stack web application powering peering at over 200 Internet Exchange Points (IXPs) globally.
https://www.ixpmanager.org/
GNU General Public License v2.0
379 stars 164 forks source link

Creating switches fails if cabinetid or infrastructure params are undefined #751

Open nickhilliard opened 2 years ago

nickhilliard commented 2 years ago
ISSUE TYPE

Bug Report

VERSION
6.2.0
SUMMARY

/switch/store-by-snmp method fails with 405 if either cabinetid or infrastructure params are left undefined.

STEPS TO REPRODUCE
  1. browse to /switch/create-by-snmp
  2. leave either "Infrastructure" or "Rack" pull-down list unchanged
  3. click Create
EXPECTED RESULTS

Should work

ACTUAL RESULTS
Oops! An Error Occurred
The server returned a "405 Method Not Allowed".

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
barryo commented 2 years ago

Issue is with $r->validate() here.

validate() returns to the referrer but in the add-by-snmp stream, the referred is the initial page where the user enters hostname and community rather than the actual form that is being edited. Will need a little bit of work to resolve.

lucix-mich commented 1 year ago

A first "fix" is to make it obvious that these fields must be populated. The next level fix would be to give a meaningful error message, but that might not be worth the effort.

kshitiz09 commented 10 months ago

Commented 'cabinetid' => 'required|integer|exists:cabinet,id', line 731 from validation got out of 405 error .

barryo commented 10 months ago

Commented 'cabinetid' => 'required|integer|exists:cabinet,id', line 731 from validation got out of 405 error .

Just populate the fields to work around it. Commented out that line may lead to database inconsistency.