Project

General

Profile

Actions

Bug #12452

closed

Non admin users cant do bulk actions on hosts

Added by Alon Goldboim almost 9 years ago. Updated over 6 years ago.

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

Description

When trying to do balk action on hosts with non admin user causes:

| ActionView::Template::Error (PG::AmbiguousColumn: ERROR:  column reference "id" is ambiguous
 | LINE 1: ... (1) AND "hosts"."type" IN ('Host::Managed') AND (id IN ('5'...
 |                                                              ^
 | : SELECT "hosts"."id" AS t0_r0, "hosts"."name" AS t0_r1, "hosts"."last_compile" AS t0_r2, "hosts"."last_report" AS t0_r3, "hosts"."updated_at" AS t0_r4, "hosts"."created_at" AS t0_r5, "hosts"."root_pass" AS t0_r6, "hosts"."architecture_id" AS t0_r7, "hosts"."operatingsystem_id" AS t0_r8, "hosts"."environment_id" AS t0_r9, "hosts"."ptable_id" AS t0_r10, "hosts"."medium_id" AS t0_r11, "hosts"."build" AS t0_r12, "hosts"."comment" AS t0_r13, "hosts"."disk" AS t0_r14, "hosts"."installed_at" AS t0_r15, "hosts"."model_id" AS t0_r16, "hosts"."hostgroup_id" AS t0_r17, "hosts"."owner_id" AS t0_r18, "hosts"."owner_type" AS t0_r19, "hosts"."enabled" AS t0_r20, "hosts"."puppet_ca_proxy_id" AS t0_r21, "hosts"."managed" AS t0_r22, "hosts"."use_image" AS t0_r23, "hosts"."image_file" AS t0_r24, "hosts"."uuid" AS t0_r25, "hosts"."compute_resource_id" AS t0_r26, "hosts"."puppet_proxy_id" AS t0_r27, "hosts"."certname" AS t0_r28, "hosts"."image_id" AS t0_r29, "hosts"."organization_id" AS t0_r30, "hosts"."location_id" AS t0_r31, "hosts"."type" AS t0_r32, "hosts"."otp" AS t0_r33, "hosts"."realm_id" AS t0_r34, "hosts"."compute_profile_id" AS t0_r35, "hosts"."provision_method" AS t0_r36, "hosts"."grub_pass" AS t0_r37, "hosts"."discovery_rule_id" AS t0_r38, "hosts"."global_status" AS t0_r39, "hosts"."lookup_value_matcher" AS t0_r40, "hostgroups"."id" AS t1_r0, "hostgroups"."name" AS t1_r1, "hostgroups"."created_at" AS t1_r2, "hostgroups"."updated_at" AS t1_r3, "hostgroups"."environment_id" AS t1_r4, "hostgroups"."operatingsystem_id" AS t1_r5, "hostgroups"."architecture_id" AS t1_r6, "hostgroups"."medium_id" AS t1_r7, "hostgroups"."ptable_id" AS t1_r8, "hostgroups"."root_pass" AS t1_r9, "hostgroups"."puppet_ca_proxy_id" AS t1_r10, "hostgroups"."use_image" AS t1_r11, "hostgroups"."image_file" AS t1_r12, "hostgroups"."ancestry" AS t1_r13, "hostgroups"."vm_defaults" AS t1_r14, "hostgroups"."subnet_id" AS t1_r15, "hostgroups"."domain_id" AS t1_r16, "hostgroups"."puppet_proxy_id" AS t1_r17, "hostgroups"."title" AS t1_r18, "hostgroups"."realm_id" AS t1_r19, "hostgroups"."compute_profile_id" AS t1_r20, "hostgroups"."grub_pass" AS t1_r21, "hostgroups"."lookup_value_matcher" AS t1_r22, "environments"."id" AS t2_r0, "environments"."name" AS t2_r1, "environments"."created_at" AS t2_r2, "environments"."updated_at" AS t2_r3, "environments"."hosts_count" AS t2_r4, "environments"."hostgroups_count" AS t2_r5, "taxonomies"."id" AS t3_r0, "taxonomies"."name" AS t3_r1, "taxonomies"."type" AS t3_r2, "taxonomies"."created_at" AS t3_r3, "taxonomies"."updated_at" AS t3_r4, "taxonomies"."ignore_types" AS t3_r5, "taxonomies"."ancestry" AS t3_r6, "taxonomies"."title" AS t3_r7, "taxonomies"."description" AS t3_r8, "locations_hosts"."id" AS t4_r0, "locations_hosts"."name" AS t4_r1, "locations_hosts"."type" AS t4_r2, "locations_hosts"."created_at" AS t4_r3, "locations_hosts"."updated_at" AS t4_r4, "locations_hosts"."ignore_types" AS t4_r5, "locations_hosts"."ancestry" AS t4_r6, "locations_hosts"."title" AS t4_r7, "locations_hosts"."description" AS t4_r8 FROM "hosts" LEFT OUTER JOIN "hostgroups" ON "hostgroups"."id" = "hosts"."hostgroup_id" LEFT OUTER JOIN "environments" ON "environments"."id" = "hosts"."environment_id" LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "hosts"."organization_id" AND "taxonomies"."type" IN ('Organization') LEFT OUTER JOIN "taxonomies" "locations_hosts" ON "locations_hosts"."id" = "hosts"."location_id" AND "locations_hosts"."type" IN ('Location') WHERE "hosts"."organization_id" IN (2) AND "hosts"."location_id" IN (1) AND "hosts"."type" IN ('Host::Managed') AND (id IN ('5') or name IN (NULL))):
 |     20:         <% associations = [:hostgroup, :environment] %>
 |     21:         <% associations << :organization if SETTINGS[:organizations_enabled]  %>
 |     22:         <% associations << :location     if SETTINGS[:locations_enabled]  %>
 |     23:         <% hosts.includes(*associations).each do |host| %>
 |     24:           <tr>
 |     25:             <td><%=h host %>
 |     26:             </td>
 |   app/views/hosts/_selected_hosts.html.erb:23:in `_43aecc12a5aa4e08714fb03fd85fb355'
 |   app/views/hosts/multiple_build.html.erb:1:in `_77b9227ac525b2e63e519dc40c5fc266'
 |   app/controllers/concerns/application_shared.rb:13:in `set_timezone'
 |   app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 |   lib/middleware/catch_json_parse_errors.rb:9:in `call'
 | 

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #8048: n+1 query on select multiple hostsClosedDaniel Lobato Garcia10/23/2014Actions
Actions

Also available in: Atom PDF