Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #6184 - Dynflowizes system update #4865

Merged
merged 1 commit into from Jan 13, 2015

Conversation

adamruzicka
Copy link
Member

No description provided.

@@ -143,8 +143,7 @@ def create
param :host_collection_ids, Array, :desc => N_("Specify the host collections as an array")
def update
system_params = system_params(params)
@system.update_attributes!(system_params)
@system.refresh_subscriptions if system_params[:autoheal]
sync_task(::Actions::Katello::System::Update, @system, system_params)
respond_for_update
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check the status of the action? (make sure it didn't fail)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need for checking the task status? When it fails it raises exception and when it's successful it passes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought if it failed in the run phase no exception would be raised. I'll verify this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you're correct, ignore me! 👍

@jlsherrill
Copy link
Member

Apologies for the delay, going to review this today.

@@ -220,8 +203,6 @@ def save_candlepin_orchestration
case orchestration_for
when :hypervisor
# it's already saved = do nothing
when :update
pre_queue.create(:name => "update candlepin consumer: #{self.name}", :priority => 3, :action => [self, :update_candlepin_consumer])
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we delete this whole method 'save_candlepin_orchestration' and get rid of the before_save that calls it?

@jlsherrill
Copy link
Member

Seeing an issue when trying to update a system:

Katello::Errors::UserNotSet

unauthenticated to call a backend engine

---
- /home/jlsherri/git/katello/app/models/katello/concerns/user_extensions.rb:61:in
  `cp_oauth_header'
- /home/jlsherri/git/katello/app/lib/katello/resources/candlepin.rb:76:in `default_headers'
- /home/jlsherri/git/katello/app/lib/katello/resources/candlepin.rb:166:in `update'
- /home/jlsherri/git/katello/app/lib/actions/candlepin/consumer/update.rb:31:in `run'
- /home/jlsherri/.rvm/gems/ruby-1.9.3-p448/gems/dynflow-0.7.5/lib/dynflow/action.rb:456:in
  `block (3 levels) in execute_run'
- /home/jlsherri/.rvm/gems/ruby-1.9.3-p448/gems/dynflow-0.7.5/lib/dynflow/middleware/stack.rb:26:in

I think app/lib/actions/candlepin/consumer/update.rb needs to inherit from Candlepin::Abstract like some of the other candlepin actions do?

end

def finalize
Resources::Candlepin::Consumer.refresh_entitlements(input[:uuid])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be ::Katello::Resources::Candlepin::Consumer I got a 'uninitialized constant' error.

when changing that class reference for testing i also get: 'Katello::Errors::UserNotSet unauthenticated to call a backend engine' here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason you did this in finalize and not as part of run?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Candlepin actions indeed need to inherit from Candlepin::Abstract, you were right about ::Katello::Resources::Candlepin::Consumer. Finalize seemed more fitting to me for the task, but run is apparently the way to go here

module Actions
module Pulp
module Consumer
class Update < Actions::EntryAction
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the same issue here, this needs to inherit from Pulp::Abstract too. This seemed to work for me:

module Actions
  module Pulp
    module Consumer
      class Update < Pulp::Abstract
        input_format do
          param :uuid, String
          param :display_name, String
        end

        def plan(system)
          plan_self(:uuid => system.uuid, :display_name => system.name)
        end

        def run
          output[:response] = pulp_extensions.consumer.update(input[:uuid], :display_name => input[:name])
        end
      end
    end
  end
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything else looks good. Feel free to squash all your commits together as you fix this and i think it'll be ready to merge.

@jlsherrill
Copy link
Member

[test]

@jlsherrill
Copy link
Member

Merging, thanks @adamruzicka ! :shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants