Dynflow tasks from hammer cli

I am trying to test the hammer command line tools against the katello
plugin. It seems that when hammer invokes an API that uses a dynflow
task the current user is not getting passed along. For a specific
example, you can use this branch:

https://github.com/bkearney/katello/tree/bkearney/repository-set-work

and then invoke this hammer command:

bundle exec ./bin/hammer repository-set info --name "Red Hat Enterprise
Linux 6 Server (Kickstart)" --product "Red Hat Enterprise Linux Server"
–organization DemoOrg

this results in

Forbidden - server refused to process the request

and on the server I see:

Processing by Apipie::ApipiesController#apipie_checksum as JSON
Parameters: {"apipy"=>{}}
Rendered
/home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/apipie-rails-0.1.3/app/views/apipie/apipies/apipie_checksum.json.erb
(0.2ms)
Completed 200 OK in 16.9ms (Views: 16.8ms | ActiveRecord: 0.0ms)
Processing by Katello::Api::V2::RepositorySetsController#show as
application/json;version=2
Parameters: {"api_version"=>"v2", "product_id"=>"6", "id"=>"1952",
"repository_set"=>{}}
Setting locale: en
Checking params for katello/api/v2/repository_sets/show
Katello::Product Load (0.5ms) SELECT "katello_products".* FROM
"katello_products" WHERE "katello_products"."id" = 6 LIMIT 1
Katello::Provider Load (0.4ms) SELECT "katello_providers".* FROM
"katello_providers" WHERE "katello_providers"."id" = 4 LIMIT 1
Organization Load (0.3ms) SELECT "taxonomies".* FROM "taxonomies"
WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = 4
ORDER BY title LIMIT 1
Katello::Errors::UserNotSet: unauthenticated to call a backend engine

Completed 403 Forbidden in 9.4ms (Views: 0.2ms | ActiveRecord: 1.2ms)
With body: {"displayMessage":"unauthenticated to call a backend
engine","errors":["unauthenticated to call a backend engine"]}

Is the current user not getting passed to the dynflow task?

– bk

Hi,

I was not able to reproduce this issue against your branch and in master, the info command
doesn't run a dynflow task (I haven't seen anything that would change that
in your repository).

The command that runs the dynflow action for scanning cdn is repository-set available-repositories
and since you already brought my attention here, I've fixed another issue, that was preventing
from using repository set name for identification

https://github.com/Katello/hammer-cli-katello/pull/157

– Ivan

··· ----- Original Message ----- > > I am trying to test the hammer command line tools against the katello > plugin. It seems that when hammer invokes an API that uses a dynflow > task the current user is not getting passed along. For a specific > example, you can use this branch: > > https://github.com/bkearney/katello/tree/bkearney/repository-set-work > > > and then invoke this hammer command: > > bundle exec ./bin/hammer repository-set info --name "Red Hat Enterprise > Linux 6 Server (Kickstart)" --product "Red Hat Enterprise Linux Server" > --organization DemoOrg > > this results in > > Forbidden - server refused to process the request > > > and on the server I see: > > Processing by Apipie::ApipiesController#apipie_checksum as JSON > Parameters: {"apipy"=>{}} > Rendered > /home/bkearney/.rvm/gems/ruby-1.9.3-p484/gems/apipie-rails-0.1.3/app/views/apipie/apipies/apipie_checksum.json.erb > (0.2ms) > Completed 200 OK in 16.9ms (Views: 16.8ms | ActiveRecord: 0.0ms) > Processing by Katello::Api::V2::RepositorySetsController#show as > application/json;version=2 > Parameters: {"api_version"=>"v2", "product_id"=>"6", "id"=>"1952", > "repository_set"=>{}} > Setting locale: en > Checking params for katello/api/v2/repository_sets/show > Katello::Product Load (0.5ms) SELECT "katello_products".* FROM > "katello_products" WHERE "katello_products"."id" = 6 LIMIT 1 > Katello::Provider Load (0.4ms) SELECT "katello_providers".* FROM > "katello_providers" WHERE "katello_providers"."id" = 4 LIMIT 1 > Organization Load (0.3ms) SELECT "taxonomies".* FROM "taxonomies" > WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = 4 > ORDER BY title LIMIT 1 > Katello::Errors::UserNotSet: unauthenticated to call a backend engine > > Completed 403 Forbidden in 9.4ms (Views: 0.2ms | ActiveRecord: 1.2ms) > With body: {"displayMessage":"unauthenticated to call a backend > engine","errors":["unauthenticated to call a backend engine"]} > > > Is the current user not getting passed to the dynflow task? > > -- bk > > -- > 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/d/optout. >

> Hi,
>
> I was not able to reproduce this issue against your branch and in master, the info command
> doesn't run a dynflow task (I haven't seen anything that would change that
> in your repository).

Misread this. I fixed it in https://github.com/Katello/katello/pull/4051

>
> The command that runs the dynflow action for scanning cdn is repository-set available-repositories
> and since you already brought my attention here, I've fixed another issue, that was preventing
> from using repository set name for identification
>
> https://github.com/Katello/hammer-cli-katello/pull/157

Acked… thanks.

– bk

··· On 05/05/2014 05:43 AM, Ivan Necas wrote: