Working on a demo script. I am hoping to create users, and add them to
an org. My create works (see previous email)
bundle exec bin/hammer -u admin -p changeme user create --login test2
–password changeme --mail bk2@bk.com --firstname bryan --lastname
kearney --admin false --auth-source-id 1
but associating to an org is failing:
bundle exec bin/hammer -u admin -p changeme organization add_user
–user-id test2 --name DemoOrg
with:
Invalid username or password
I can log into the UI and do this no issues. I have tried --user-id as
both the numerical id (4 in this case) to no avail. Where should I look
next? Server stack is below
Setting current user thread-local variable to Admin User
User Load (0.3ms) SELECT "users".* FROM "users" WHERE
"users"."login" = 'admin' LIMIT 1
Authorized user admin(Admin User)
Setting current user thread-local variable to Admin User
Organization Load (0.3ms) SELECT "taxonomies".* FROM "taxonomies"
WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = 2
LIMIT 1
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'Organization'
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'Hostgroup'
(0.1ms) SELECT "katello_environments".id FROM
"katello_environments" WHERE "katello_environments"."organization_id" = 2
(0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'Domain'
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'Medium'
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'Subnet'
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'ComputeResource'
(0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'SmartProxy'
(0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'User'
(0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
"taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
"taxable_taxonomies"."taxable_type" = 'ConfigTemplate'
Rendered api/v2/taxonomies/show.json.rabl (131.1ms)
Body:
{"id":2,"name":"DemoOrg","created_at":"2014-02-14T19:51:01Z","updated_at":"2014-02-14T21:03:45Z","organization_ids":[],"hostgroup_ids":[],"environment_ids":[2],"domain_ids":[],"medium_ids":[],"subnet_ids":[],"compute_resource_ids":[],"smart_proxy_ids":[],"user_ids":[4],"config_template_ids":[],"select_all_types":[]}
Completed 200 OK in 359.4ms (Views: 137.3ms | ActiveRecord: 181.0ms)
Started GET "/api/users/test2" for 127.0.0.1 at 2014-02-14 16:08:22 -0500
Processing by Api::V2::UsersController#show as JSON
Parameters: {"apiv"=>"v2", "id"=>"test2", "user"=>{}}
Rendered api/v2/errors/unauthorized.json.rabl within
api/v2/layouts/error_layout (0.6ms)
Filter chain halted as :authorize rendered or redirected
Completed 401 Unauthorized in 5.1ms (Views: 4.0ms | ActiveRecord: 0.0ms)
– bk
Awful regression. I'm creating a PR for that right now:
http://projects.theforeman.org/issues/4361
T.
···
On 02/14/2014 10:11 PM, Bryan Kearney wrote:
> Working on a demo script. I am hoping to create users, and add them to
> an org. My create works (see previous email)
>
> bundle exec bin/hammer -u admin -p changeme user create --login test2
> --password changeme --mail bk2@bk.com --firstname bryan --lastname
> kearney --admin false --auth-source-id 1
>
>
> but associating to an org is failing:
>
> bundle exec bin/hammer -u admin -p changeme organization add_user
> --user-id test2 --name DemoOrg
>
>
> with:
>
> Invalid username or password
>
> I can log into the UI and do this no issues. I have tried --user-id as
> both the numerical id (4 in this case) to no avail. Where should I look
> next? Server stack is below
>
> Setting current user thread-local variable to Admin User
> User Load (0.3ms) SELECT "users".* FROM "users" WHERE
> "users"."login" = 'admin' LIMIT 1
> Authorized user admin(Admin User)
> Setting current user thread-local variable to Admin User
> Organization Load (0.3ms) SELECT "taxonomies".* FROM "taxonomies"
> WHERE "taxonomies"."type" IN ('Organization') AND "taxonomies"."id" = 2
> LIMIT 1
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'Organization'
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'Hostgroup'
> (0.1ms) SELECT "katello_environments".id FROM
> "katello_environments" WHERE "katello_environments"."organization_id" = 2
> (0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'Domain'
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'Medium'
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'Subnet'
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'ComputeResource'
> (0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'SmartProxy'
> (0.1ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'User'
> (0.2ms) SELECT "taxable_taxonomies"."taxable_id" FROM
> "taxable_taxonomies" WHERE "taxable_taxonomies"."taxonomy_id" = 2 AND
> "taxable_taxonomies"."taxable_type" = 'ConfigTemplate'
> Rendered api/v2/taxonomies/show.json.rabl (131.1ms)
> Body:
> {"id":2,"name":"DemoOrg","created_at":"2014-02-14T19:51:01Z","updated_at":"2014-02-14T21:03:45Z","organization_ids":[],"hostgroup_ids":[],"environment_ids":[2],"domain_ids":[],"medium_ids":[],"subnet_ids":[],"compute_resource_ids":[],"smart_proxy_ids":[],"user_ids":[4],"config_template_ids":[],"select_all_types":[]}
>
> Completed 200 OK in 359.4ms (Views: 137.3ms | ActiveRecord: 181.0ms)
>
>
> Started GET "/api/users/test2" for 127.0.0.1 at 2014-02-14 16:08:22 -0500
> Processing by Api::V2::UsersController#show as JSON
> Parameters: {"apiv"=>"v2", "id"=>"test2", "user"=>{}}
> Rendered api/v2/errors/unauthorized.json.rabl within
> api/v2/layouts/error_layout (0.6ms)
> Filter chain halted as :authorize rendered or redirected
> Completed 401 Unauthorized in 5.1ms (Views: 4.0ms | ActiveRecord: 0.0ms)
>
>
>
> -- bk
>