Failed to create new host using non admin users

RHEL6.5
Foreman 1.7.5
ruby193

I 99% absolute that this problem was suddenly appeared because i was using
"New Host" option with non Admin users in the past.

Any help will be appreciated.

Following is the UI exception full trace.

ActiveRecord::StatementInvalid
PGError: ERROR: column reference "name" is ambiguous LINE 71: WHERE
"taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT
"compute_resources"."id" AS t0_r0, "compute_resources"."name" AS t0_r1,
"compute_resources"."description" AS t0_r2, "compute_resources"."url" AS
t0_r3, "compute_resources"."user" AS t0_r4, "compute_resources"."password"
AS t0_r5, "compute_resources"."uuid" AS t0_r6, "compute_resources"."type"
AS t0_r7, "compute_resources"."created_at" AS t0_r8,
"compute_resources"."updated_at" AS t0_r9, "compute_resources"."attrs" AS
t0_r10, "taxonomies"."id" AS t1_r0, "taxonomies"."name" AS t1_r1,
"taxonomies"."type" AS t1_r2, "taxonomies"."created_at" AS t1_r3,
"taxonomies"."updated_at" AS t1_r4, "taxonomies"."ignore_types" AS t1_r5,
"taxonomies"."ancestry" AS t1_r6, "taxonomies"."title" AS t1_r7,
"locations_compute_resources"."id" AS t2_r0,
"locations_compute_resources"."name" AS t2_r1,
"locations_compute_resources"."type" AS t2_r2,
"locations_compute_resources"."created_at" AS t2_r3,
"locations_compute_resources"."updated_at" AS t2_r4,
"locations_compute_resources"."ignore_types" AS t2_r5,
"locations_compute_resources"."ancestry" AS t2_r6,
"locations_compute_resources"."title" AS t2_r7 FROM "compute_resources"
LEFT OUTER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxable_id" =
"compute_resources"."id" AND "taxable_taxonomies"."taxable_type" =
'ComputeResource' LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" =
"taxable_taxonomies"."taxonomy_id" AND taxonomies.type='Organization' LEFT
OUTER JOIN "taxable_taxonomies" "taxable_taxonomies_compute_resources_join"
ON "taxable_taxonomies_compute_resources_join"."taxable_id" =
"compute_resources"."id" AND
"taxable_taxonomies_compute_resources_join"."taxable_type" =
'ComputeResource' LEFT OUTER JOIN "taxonomies"
"locations_compute_resources" ON "locations_compute_resources"."id" =
"taxable_taxonomies_compute_resources_join"."taxonomy_id" AND
taxonomies.type='Location' WHERE "compute_resources"."id" IN (2) AND (1=1)
AND (((("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '4' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '9' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '14' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '16' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '17' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '15' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '19' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '18' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '20' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '7' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '5' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Organization' WHERE "taxonomies"."id" = '6' ))) AND
(("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Location' WHERE "taxonomies"."id" = '2' )) OR
("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM
"compute_resources" INNER JOIN "taxable_taxonomies" ON
"compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND
taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON
"taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND
taxonomies.type='Location' WHERE "taxonomies"."id" = '1' ))))) ORDER BY
name

app/helpers/layout_helper.rb:113:in block in select_f' app/helpers/layout_helper.rb:164:inblock (3 levels) in field'
app/helpers/layout_helper.rb:163:in block (2 levels) in field' app/helpers/layout_helper.rb:152:inblock in field'
app/helpers/layout_helper.rb:151:in field' app/helpers/layout_helper.rb:111:inselect_f'
app/views/hosts/_form.html.erb:58:in block (2 levels) in _app_views_hosts__form_html_erb___2831793403978641145_70195239768440' app/helpers/layout_helper.rb:268:inform_for'
app/views/hosts/_form.html.erb:8:in block in _app_views_hosts__form_html_erb___2831793403978641145_70195239768440' app/models/taxonomy.rb:59:inblock (2 levels) in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:148:in as_location' app/models/taxonomy.rb:58:inblock in as_taxonomy'
app/models/concerns/foreman/thread_session.rb:113:in as_org' app/models/taxonomy.rb:57:inas_taxonomy'
app/views/hosts/_form.html.erb:6:in
_app_views_hosts__form_html_erb___2831793403978641145_70195239768440' app/views/hosts/new.html.erb:7:in_app_views_hosts_new_html_erb__4430853681146229223_70195239700480'
app/models/concerns/foreman/thread_session.rb:33:in clear_thread' lib/middleware/catch_json_parse_errors.rb:9:incall'

Anyone ???

··· On Thursday, April 30, 2015 at 12:39:04 PM UTC+3, Avi Tal wrote: > > RHEL6.5 > Foreman 1.7.5 > ruby193 > > I 99% absolute that this problem was suddenly appeared because i was using > "New Host" option with non Admin users in the past. > > Any help will be appreciated. > > Following is the UI exception full trace. > > *ActiveRecord::StatementInvalid* > *PGError: ERROR: column reference "name" is ambiguous LINE 71: WHERE > "taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT > "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS t0_r1, > "compute_resources"."description" AS t0_r2, "compute_resources"."url" AS > t0_r3, "compute_resources"."user" AS t0_r4, "compute_resources"."password" > AS t0_r5, "compute_resources"."uuid" AS t0_r6, "compute_resources"."type" > AS t0_r7, "compute_resources"."created_at" AS t0_r8, > "compute_resources"."updated_at" AS t0_r9, "compute_resources"."attrs" AS > t0_r10, "taxonomies"."id" AS t1_r0, "taxonomies"."name" AS t1_r1, > "taxonomies"."type" AS t1_r2, "taxonomies"."created_at" AS t1_r3, > "taxonomies"."updated_at" AS t1_r4, "taxonomies"."ignore_types" AS t1_r5, > "taxonomies"."ancestry" AS t1_r6, "taxonomies"."title" AS t1_r7, > "locations_compute_resources"."id" AS t2_r0, > "locations_compute_resources"."name" AS t2_r1, > "locations_compute_resources"."type" AS t2_r2, > "locations_compute_resources"."created_at" AS t2_r3, > "locations_compute_resources"."updated_at" AS t2_r4, > "locations_compute_resources"."ignore_types" AS t2_r5, > "locations_compute_resources"."ancestry" AS t2_r6, > "locations_compute_resources"."title" AS t2_r7 FROM "compute_resources" > LEFT OUTER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxable_id" = > "compute_resources"."id" AND "taxable_taxonomies"."taxable_type" = > 'ComputeResource' LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = > "taxable_taxonomies"."taxonomy_id" AND taxonomies.type='Organization' LEFT > OUTER JOIN "taxable_taxonomies" "taxable_taxonomies_compute_resources_join" > ON "taxable_taxonomies_compute_resources_join"."taxable_id" = > "compute_resources"."id" AND > "taxable_taxonomies_compute_resources_join"."taxable_type" = > 'ComputeResource' LEFT OUTER JOIN "taxonomies" > "locations_compute_resources" ON "locations_compute_resources"."id" = > "taxable_taxonomies_compute_resources_join"."taxonomy_id" AND > taxonomies.type='Location' WHERE "compute_resources"."id" IN (2) AND (1=1) > AND (((("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '4' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '9' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '14' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '16' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '17' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '15' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '19' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '18' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '20' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '7' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '5' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Organization' WHERE "taxonomies"."id" = '6' ))) AND > (("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Location' WHERE "taxonomies"."id" = '2' )) OR > ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM > "compute_resources" INNER JOIN "taxable_taxonomies" ON > "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND > taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON > "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND > taxonomies.type='Location' WHERE "taxonomies"."id" = '1' ))))) ORDER BY > name* > app/helpers/layout_helper.rb:113:in `block in select_f' > app/helpers/layout_helper.rb:164:in `block (3 levels) in field' > app/helpers/layout_helper.rb:163:in `block (2 levels) in field' > app/helpers/layout_helper.rb:152:in `block in field' > app/helpers/layout_helper.rb:151:in `field' > app/helpers/layout_helper.rb:111:in `select_f' > app/views/hosts/_form.html.erb:58:in `block (2 levels) in > _app_views_hosts__form_html_erb___2831793403978641145_70195239768440' > app/helpers/layout_helper.rb:268:in `form_for' > app/views/hosts/_form.html.erb:8:in `block in > _app_views_hosts__form_html_erb___2831793403978641145_70195239768440' > app/models/taxonomy.rb:59:in `block (2 levels) in as_taxonomy' > app/models/concerns/foreman/thread_session.rb:148:in `as_location' > app/models/taxonomy.rb:58:in `block in as_taxonomy' > app/models/concerns/foreman/thread_session.rb:113:in `as_org' > app/models/taxonomy.rb:57:in `as_taxonomy' > app/views/hosts/_form.html.erb:6:in > `_app_views_hosts__form_html_erb___2831793403978641145_70195239768440' > app/views/hosts/new.html.erb:7:in > `_app_views_hosts_new_html_erb__4430853681146229223_70195239700480' > app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' > lib/middleware/catch_json_parse_errors.rb:9:in `call' >

This looks like the UI trying to sort the list of compute resources and
not being precise about which column to use, probably introduced by
Bug #7886: Compute Resources in new host form should be ordered - Foreman.

Try changing app/views/hosts/_form.html.erb line 58 from "order(:name)"
to "order('compute_resources.name')". You might need to do the same on
the environment list on line 76 with order('environments.name') as #6214
changed that too, plus others in app/helpers/hosts_and_hostgroups_helper.rb.

We got a change into ruby193-rubygem-activerecord some time ago which
was meant to partially fix this bug (it's only present in the RPMs as
they're older), so it might be worth checking this is up to date, as I
haven't seen this reported by anybody else.

Cheers,

··· On 30/04/15 10:39, Avi Tal wrote: > RHEL6.5 > Foreman 1.7.5 > ruby193 > > I 99% absolute that this problem was suddenly appeared because i was > using "New Host" option with non Admin users in the past. > > Any help will be appreciated. > > Following is the UI exception full trace. > > /ActiveRecord::StatementInvalid/ > *PGError: ERROR: column reference "name" is ambiguous LINE 71: WHERE > "taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT > "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS t0_r1,


Dominic Cleal
Red Hat Engineering

I am using ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt.noarch
Is there any newer version?

··· On Friday, May 1, 2015 at 11:54:24 AM UTC+3, Dominic Cleal wrote: > > On 30/04/15 10:39, Avi Tal wrote: > > RHEL6.5 > > Foreman 1.7.5 > > ruby193 > > > > I 99% absolute that this problem was suddenly appeared because i was > > using "New Host" option with non Admin users in the past. > > > > Any help will be appreciated. > > > > Following is the UI exception full trace. > > > > /ActiveRecord::StatementInvalid/ > > *PGError: ERROR: column reference "name" is ambiguous LINE 71: WHERE > > "taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT > > "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS t0_r1, > > This looks like the UI trying to sort the list of compute resources and > not being precise about which column to use, probably introduced by > http://projects.theforeman.org/issues/7886. > > Try changing app/views/hosts/_form.html.erb line 58 from "order(:name)" > to "order('compute_resources.name')". You might need to do the same on > the environment list on line 76 with order('environments.name') as #6214 > changed that too, plus others in > app/helpers/hosts_and_hostgroups_helper.rb. > > We got a change into ruby193-rubygem-activerecord some time ago which > was meant to partially fix this bug (it's only present in the RPMs as > they're older), so it might be worth checking this is up to date, as I > haven't seen this reported by anybody else. > > Cheers, > > -- > Dominic Cleal > Red Hat Engineering >

Hm, that does seem to be the most recent, perhaps Foreman does need
those suggested fixes then.

··· -- Dominic Cleal Red Hat Engineering

On 01/05/15 10:08, Avi Tal wrote:

I am using ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt.noarch
Is there any newer version?

On Friday, May 1, 2015 at 11:54:24 AM UTC+3, Dominic Cleal wrote:

On 30/04/15 10:39, Avi Tal wrote:
> RHEL6.5
> Foreman 1.7.5
> ruby193
>
> I 99% absolute that this problem was suddenly appeared because i was
> using "New Host" option with non Admin users in the past.
>
> Any help will be appreciated.
>
> Following is the UI exception full trace.
>
> /ActiveRecord::StatementInvalid/
> *PGError: ERROR: column reference "name" is ambiguous LINE 71: WHERE
> "taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT
> "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS
t0_r1,

This looks like the UI trying to sort the list of compute resources and
not being precise about which column to use, probably introduced by
http://projects.theforeman.org/issues/7886
<http://projects.theforeman.org/issues/7886>.

Try changing app/views/hosts/_form.html.erb line 58 from "order(:name)"
to "order('compute_resources.name
<http://compute_resources.name>')".  You might need to do the same on
the environment list on line 76 with order('environments.name
<http://environments.name>') as #6214
changed that too, plus others in
app/helpers/hosts_and_hostgroups_helper.rb.

We got a change into ruby193-rubygem-activerecord some time ago which
was meant to partially fix this bug (it's only present in the RPMs as
they're older), so it might be worth checking this is up to date, as I
haven't seen this reported by anybody else.

Cheers,

-- 
Dominic Cleal
Red Hat Engineering


You received this message because you are subscribed to the Google
Groups “Foreman users” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to foreman-users+unsubscribe@googlegroups.com
mailto:foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com
mailto:foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

So i have only changed app/views/hosts/_form.html.erb line 58 from
"order(:name)" to "order('compute_resources.name')” and it solved my
problem.

··· On Friday, May 1, 2015 at 12:25:40 PM UTC+3, Dominic Cleal wrote: > > Hm, that does seem to be the most recent, perhaps Foreman does need > those suggested fixes then. > > -- > Dominic Cleal > Red Hat Engineering > > On 01/05/15 10:08, Avi Tal wrote: > > I am using ruby193-rubygem-activerecord-3.2.8-8.2.el6.centos.alt.noarch > > Is there any newer version? > > > > > > > > > > On Friday, May 1, 2015 at 11:54:24 AM UTC+3, Dominic Cleal wrote: > > > > On 30/04/15 10:39, Avi Tal wrote: > > > RHEL6.5 > > > Foreman 1.7.5 > > > ruby193 > > > > > > I 99% absolute that this problem was suddenly appeared because i > was > > > using "New Host" option with non Admin users in the past. > > > > > > Any help will be appreciated. > > > > > > Following is the UI exception full trace. > > > > > > /ActiveRecord::StatementInvalid/ > > > *PGError: ERROR: column reference "name" is ambiguous LINE 71: > WHERE > > > "taxonomies"."id" = '1' ))))) ORDER BY name ^ : SELECT > > > "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS > > t0_r1, > > > > This looks like the UI trying to sort the list of compute resources > and > > not being precise about which column to use, probably introduced by > > http://projects.theforeman.org/issues/7886 > > . > > > > Try changing app/views/hosts/_form.html.erb line 58 from > "order(:name)" > > to "order('compute_resources.name > > ')". You might need to do the same > on > > the environment list on line 76 with order('environments.name > > ') as #6214 > > changed that too, plus others in > > app/helpers/hosts_and_hostgroups_helper.rb. > > > > We got a change into ruby193-rubygem-activerecord some time ago > which > > was meant to partially fix this bug (it's only present in the RPMs > as > > they're older), so it might be worth checking this is up to date, as > I > > haven't seen this reported by anybody else. > > > > Cheers, > > > > -- > > Dominic Cleal > > Red Hat Engineering > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Foreman users" group. > > To unsubscribe from this group and stop receiving emails from it, send > > an email to foreman-user...@googlegroups.com > > <mailto:foreman-users+unsubscribe@googlegroups.com >. > > To post to this group, send email to forema...@googlegroups.com > > > <mailto:forema...@googlegroups.com >. > > Visit this group at http://groups.google.com/group/foreman-users. > > For more options, visit https://groups.google.com/d/optout. > >