Bug #6786

Cannot create an organization.

Added by Partha Aji almost 4 years ago. Updated 8 days ago.

Assignee:David Davis
Target version:1.6.0
Difficulty:trivial Team Backlog:
Triaged: Fixed in Releases:
Bugzilla link:1116043 Found in Releases:
Pull request:https://github.com/theforeman/foreman/pull/1619


Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1116043
Description of Problem ======================

Cannot create an "Organization" entity.

Version-Release number of selected component (if applicable) ============================================================

  • apr-util-ldap-1.3.9-3.el6_0.1.x86_64
  • candlepin-0.9.19-1.el6_5.noarch
  • candlepin-scl-1-5.el6_4.noarch
  • candlepin-scl-quartz-2.1.5-5.el6_4.noarch
  • candlepin-scl-rhino-1.7R3-1.el6_4.noarch
  • candlepin-scl-runtime-1-5.el6_4.noarch
  • candlepin-selinux-0.9.19-1.el6_5.noarch
  • candlepin-tomcat6-0.9.19-1.el6_5.noarch
  • elasticsearch-0.90.10-4.el6sat.noarch
  • foreman-
  • foreman-compute-
  • foreman-gce-
  • foreman-libvirt-
  • foreman-ovirt-
  • foreman-postgresql-
  • foreman-proxy-
  • foreman-selinux-1.6.0-5.el6sat.noarch
  • foreman-vmware-
  • katello-1.5.0-26.el6sat.noarch
  • katello-ca-1.0-1.noarch
  • katello-certs-tools-1.5.5-1.el6sat.noarch
  • katello-installer-0.0.53-1.el6sat.noarch
  • openldap-2.4.23-31.el6.x86_64
  • pulp-katello-0.3-3.el6sat.noarch
  • pulp-nodes-common-2.4.0-0.23.beta.el6sat.noarch
  • pulp-nodes-parent-2.4.0-0.23.beta.el6sat.noarch
  • pulp-puppet-plugins-2.4.0-0.23.beta.el6sat.noarch
  • pulp-puppet-tools-2.4.0-0.23.beta.el6sat.noarch
  • pulp-rpm-plugins-2.4.0-0.23.beta.el6sat.noarch
  • pulp-selinux-2.4.0-0.23.beta.el6sat.noarch
  • pulp-server-2.4.0-0.23.beta.el6sat.noarch
  • python-ldap-2.3.10-1.el6.x86_64
  • ruby193-rubygem-net-ldap-0.3.1-3.el6sat.noarch
  • ruby193-rubygem-runcible-1.1.0-2.el6sat.noarch

How Reproducible ================


Steps to Reproduce ==================

1. Make an HTTP POST request to api/v2/organizations, and only specify a name.
2. Alternately, clone the robottelo source code and execute `nosetests -c robottelo.properties tests/foreman/api/test_organization_v2.py`
3. Alternately, clone the robottelo source code and execute `python -m unittest tests.foreman.api.test_organization_v2`

Actual Results ==============

An HTTP 500 error with the following error message:
"undefined method `[]' for nil:NilClass"

Expected Results ================

Expected an HTTP 201 response status code.

Additional Info ===============

For test source code, see: https://github.com/omaciel/robottelo/blob/master/tests/foreman/api/test_organization_v2.py#L56

There is already a similar test here: https://github.com/omaciel/robottelo/blob/master/tests/foreman/api/test_org.py#L22

However, the existing tests specifies a blank label and description, whereas the failing test completely omits a label and description.

Related issues

Related to Foreman - Bug #6446: We need to either support non-json requests or show an er... Closed 06/30/2014

Associated revisions

Revision f5317a04
Added by David Davis almost 4 years ago

Fixes #6786 - Handle error when no taxonomy params get sent

Basically, no organization params are getting sent as the bug reporter is not
using json and not using wrapped params. You can also test this by doing:

curl -X POST http://localhost:3000/api/v2/organizations

This change prevents the following error from getting raised:

Processing by Api::V2::OrganizationsController#create as JSON
Parameters: {"description"=>"biz", "name"=>"foo", "label"=>"bar", "apiv"=>"v2"}
Expire fragment views/tabs_and_title_records-1 (0.1ms)
Authorized user admin(Admin User)
undefined method `[]' for nil:NilClass (NoMethodError)
/usr/share/foreman/app/controllers/concerns/api/v2/taxonomies_controller.rb:75:in `params_match_database'


#1 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Target version set to 49
  • Pull request https://github.com/theforeman/foreman/pull/1619 added

#2 Updated by David Davis almost 4 years ago

I opened a PR to prevent the nil error from being raised. This might suffice as a solution for this bug:


Waiting to here on people's opinions on foreman-dev.

#3 Updated by David Davis almost 4 years ago

  • Related to Bug #6446: We need to either support non-json requests or show an error when a user submits other content types. added

#4 Updated by Eric Helms almost 4 years ago

  • Target version changed from 49 to 54

#5 Updated by David Davis almost 4 years ago

  • Assignee changed from Bryan Kearney to David Davis

#6 Updated by David Davis almost 4 years ago

  • Project changed from Katello to Foreman
  • Category deleted (API)
  • Target version deleted (54)

#7 Updated by David Davis almost 4 years ago

  • Category set to API
  • Difficulty set to trivial

#8 Updated by Dominic Cleal almost 4 years ago

  • Target version set to 1.7.5
  • Legacy Backlogs Release (now unused) set to 10

#9 Updated by David Davis almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF