Next issue... missing methods for org

Looks like the the concerns for org
(Katello::Concerns::OrganizationExtensions) are not getting loaded when
I call the katello api v2. Calling this cli:

bundle exec bin/hammer -u admin -p changeme lifecycle-environment create
–organization-id DemoOrg --name TEST --prior Library

I get the following stack trace

Setting current user thread-local variable to admin
Checking params for katello/api/v2/environments/create
NoMethodError: undefined method without_deleting' for #<Class:0x00000009206490> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/dynamic_matchers.rb:55:inmethod_missing'
/home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:131:in
get_organization' /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:115:infind_optional_organization'
/home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:98:in
find_organization' /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:520:inblock (3 levels) in
_run__1415486125253698300__process_action__840835398371412458__callbacks'
/home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:215:in
block in _conditional_callback_around_27341' /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:326:inaround'

  • bk

> From: "Bryan Kearney" <bkearney@redhat.com>
> To: "Foreman ." <foreman-dev@googlegroups.com>
> Sent: Wednesday, January 22, 2014 6:38:30 AM
> Subject: [foreman-dev] Next issue… missing methods for org
>
> Looks like the the concerns for org
> (Katello::Concerns::OrganizationExtensions) are not getting loaded when
> I call the katello api v2. Calling this cli:
>
> bundle exec bin/hammer -u admin -p changeme lifecycle-environment create
> --organization-id DemoOrg --name TEST --prior Library
>
> I get the following stack trace
>
> Setting current user thread-local variable to admin
> Checking params for katello/api/v2/environments/create
> NoMethodError: undefined method without_deleting&#39; for &gt; #&lt;Class:0x00000009206490&gt; &gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/dynamic_matchers.rb:55:in &gt;method_missing'
> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:131:in
> get_organization&#39; &gt; /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:115:in &gt;find_optional_organization'
> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:98:in
> find_organization&#39; &gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:520:in &gt;block (3 levels) in
> _run__1415486125253698300__process_action__840835398371412458__callbacks'
> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:215:in
> block in _conditional_callback_around_27341&#39; &gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:326:in &gt;around'
>
>
> - bk

this is an issue that hasn't quite been resolved yet on the server side. it's something to do with Katello's organization being an extention of Foreman's organization. Somewhere in the call stack, the Foreman organization probably gets reloaded and Katello's organization gets skipped. Restart your Foreman/Katello server and you should ™ be fine.

··· ----- Original Message -----


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  • adam price

I have. i think it has to do with a pre create hook.

— bk

··· On 01/22/2014 10:13 AM, Adam Price wrote: > ----- Original Message ----- >> From: "Bryan Kearney" >> To: "Foreman ." >> Sent: Wednesday, January 22, 2014 6:38:30 AM >> Subject: [foreman-dev] Next issue... missing methods for org >> >> Looks like the the concerns for org >> (Katello::Concerns::OrganizationExtensions) are not getting loaded when >> I call the katello api v2. Calling this cli: >> >> bundle exec bin/hammer -u admin -p changeme lifecycle-environment create >> --organization-id DemoOrg --name TEST --prior Library >> >> I get the following stack trace >> >> Setting current user thread-local variable to admin >> Checking params for katello/api/v2/environments/create >> NoMethodError: undefined method `without_deleting' for >> # >> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/dynamic_matchers.rb:55:in >> `method_missing' >> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:131:in >> `get_organization' >> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:115:in >> `find_optional_organization' >> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:98:in >> `find_organization' >> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:520:in >> `block (3 levels) in >> _run__1415486125253698300__process_action__840835398371412458__callbacks' >> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:215:in >> `block in _conditional_callback_around_27341' >> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:326:in >> `around' >> >> >> - bk > > this is an issue that hasn't quite been resolved yet on the server side. it's something to do with Katello's organization being an extention of Foreman's organization. Somewhere in the call stack, the Foreman organization probably gets reloaded and Katello's organization gets skipped. Restart your Foreman/Katello server and you should ™ be fine.

> From: "Bryan Kearney" <bryan.kearney@gmail.com>
> To: foreman-dev@googlegroups.com
> Sent: Wednesday, January 22, 2014 10:18:38 AM
> Subject: Re: [foreman-dev] Next issue… missing methods for org
>
> >> From: "Bryan Kearney" <bkearney@redhat.com>
> >> To: "Foreman ." <foreman-dev@googlegroups.com>
> >> Sent: Wednesday, January 22, 2014 6:38:30 AM
> >> Subject: [foreman-dev] Next issue… missing methods for org
> >>
> >> Looks like the the concerns for org
> >> (Katello::Concerns::OrganizationExtensions) are not getting loaded when
> >> I call the katello api v2. Calling this cli:
> >>
> >> bundle exec bin/hammer -u admin -p changeme lifecycle-environment create
> >> --organization-id DemoOrg --name TEST --prior Library
> >>
> >> I get the following stack trace
> >>
> >> Setting current user thread-local variable to admin
> >> Checking params for katello/api/v2/environments/create
> >> NoMethodError: undefined method without_deleting&#39; for &gt; &gt;&gt; #&lt;Class:0x00000009206490&gt; &gt; &gt;&gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-3.2.16/lib/active_record/dynamic_matchers.rb:55:in &gt; &gt;&gt;method_missing'
> >> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:131:in
> >> get_organization&#39; &gt; &gt;&gt; /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:115:in &gt; &gt;&gt;find_optional_organization'
> >> /home/bkearney/code/katello/app/controllers/katello/api/v2/api_controller.rb:98:in
> >> find_organization&#39; &gt; &gt;&gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:520:in &gt; &gt;&gt;block (3 levels) in
> >> _run__1415486125253698300__process_action__840835398371412458__callbacks'
> >> /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:215:in
> >> block in _conditional_callback_around_27341&#39; &gt; &gt;&gt; /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/activesupport-3.2.16/lib/active_support/callbacks.rb:326:in &gt; &gt;&gt;around'
> >>
> >>
> >> - bk
> >
> > this is an issue that hasn't quite been resolved yet on the server side.
> > it's something to do with Katello's organization being an extention of
> > Foreman's organization. Somewhere in the call stack, the Foreman
> > organization probably gets reloaded and Katello's organization gets
> > skipped. Restart your Foreman/Katello server and you should ™ be fine.
>
> I have. i think it has to do with a pre create hook.
>
> — bk

you aren't wrong. there's a

before_filter :find_organization, :only => [:index, :create, :paths]
^^^^^^^

to look up the organization when you create a system.

it boils down to this method:

def get_organization(org_id)

name/label is always unique

return Organization.without_deleting.having_name_or_label(org_id).first
^^^^^^^^^^^^^^^^
end

#without_deleting is defined in app/models/katello/concerns/organization_extension.rb and "method_missing" only complains occasionally which makes me think one piece, but not all, is getting reloaded.

··· ----- Original Message ----- > On 01/22/2014 10:13 AM, Adam Price wrote: > > ----- Original Message -----


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

  • adam price