Project

General

Profile

Actions

Bug #2745

closed

Can't create new hosts when using a role:

Added by Peter Gustafsson almost 11 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi,

I have created a new role named Developer with below permissions

  1. curl -k -u admin:changeme -H "Accept:application/json" http://192.168.122.2/api/roles/9 {"role":{"name":"Developer","id":9,"builtin":0,"permissions":["view_architectures","view_audit_logs","view_authenticators","view_compute_resources","view_compute_resources_vms","create_compute_resources_vms","edit_compute_resources_vms","destroy_compute_resources_vms","power_compute_resources_vms","console_compute_resources_vms","view_templates","access_dashboard","view_domains","view_environments","view_external_variables","view_facts","view_globals","edit_classes","create_params","edit_params","destroy_params","view_hostgroups","create_hostgroups","edit_hostgroups","view_hosts","create_hosts","edit_hosts","destroy_hosts","build_hosts","power_hosts","console_hosts","ipmi_boot","puppetrun_hosts","view_images","view_locations","assign_locations","view_media","view_models","view_operatingsystems","view_organizations","assign_organizations","view_ptables","view_puppetclasses","edit_puppetclasses","import_puppetclasses","view_reports","access_settings","view_smart_proxies","view_smart_proxies_autosign","view_smart_proxies_puppetca","view_statistics","view_subnets","view_tasks","view_trends"]}}

But if i login with an user that has that role assigned to it and go to Hosts = New Host i get: undefined method `id' for nil:NilClass

Below is the full trace:

NoMethodError
undefined method `id' for nil:NilClass
app/views/hosts/_form.html.erb:33:in `block (2 levels) in app_views_hosts_form_html_erb__2378529037674961145_70291608880940'
app/helpers/layout_helper.rb:211:in `form_for'
app/views/hosts/_form.html.erb:7:in `block in app_views_hosts_form_html_erb__2378529037674961145_70291608880940'
app/models/taxonomy.rb:55:in `block (2 levels) in as_taxonomy'
lib/foreman/thread_session.rb:140:in `as_location'
app/models/taxonomy.rb:54:in `block in as_taxonomy'
lib/foreman/thread_session.rb:105:in `as_org'
app/models/taxonomy.rb:53:in `as_taxonomy'
app/views/hosts/_form.html.erb:5:in `_app_views_hosts__form_html_erb__2378529037674961145_70291608880940'
app/views/hosts/new.html.erb:3:in `_app_views_hosts_new_html_erb__2608971387066822571_70291526843260'
lib/foreman/thread_session.rb:31:in `clear_thread'

I'm using foreman 1.2 stable.

Br, Peter

Actions #1

Updated by Peter Gustafsson almost 11 years ago

The user did not belong to the Org and Location after adding the user to the Org and Location from More => Users => Edit user,
It now works.

Actions #2

Updated by Greg Sutcliffe almost 11 years ago

  • Status changed from New to Feedback

Glad you got it sorted - Can we close this? Or is there more discussion to be had around Orgs & Locs?

Actions #3

Updated by Benjamin Papillon about 10 years ago

  • Description updated (diff)
  • Status changed from Feedback to Closed

I'm closing the bug as there has been no feedback over few months now. Please feel free to open a new ticket or reopen this one for more informations.

Actions

Also available in: Atom PDF