Project

General

Profile

Actions

Bug #27740

closed

Cannot set parameter for hostgroup

Added by Ondřej Pražák over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host groups
Target version:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:
1) hammer hostgroup set-parameter --hostgroup my-hostgroup --name foo --value bar

2019-08-30T01:42:11 [I|app|82078886] Started POST "/api/hostgroups/3/parameters" for fe80::2e0:81ff:fed1:b1cb at 2019-08-30 01:42:11 -0400
2019-08-30T01:42:11 [I|app|82078886] Processing by Api::V2::ParametersController#create as JSON
2019-08-30T01:42:11 [I|app|82078886]   Parameters: {"parameter"=>{"name"=>"foo", "value"=>"[FILTERED]", "parameter_type"=>"string", "hidden_value"=>"[FILTERED]"}, "apiv"=>"v2", "hostgroup_id"=>"3"}
2019-08-30T01:42:11 [I|app|82078886] Authorized user admin(Admin User)
2019-08-30T01:42:11 [W|app|82078886] Action failed
ActiveModel::UnknownAttributeError: unknown attribute 'location_id' for GroupParameter.
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:53:in `_assign_attribute'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:44:in `block in _assign_attributes'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:43:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:43:in `_assign_attributes'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/attribute_assignment.rb:23:in `_assign_attributes'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:35:in `assign_attributes'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/core.rb:314:in `initialize'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:66:in `new'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/inheritance.rb:66:in `new'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/reflection.rb:154:in `build_association'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/association.rb:276:in `build_record'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/collection_association.rb:106:in `build'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/collection_proxy.rb:319:in `build'
/usr/share/foreman/app/controllers/api/v2/parameters_controller.rb:86:in `create'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/usr/share/foreman/app/controllers/api/v2/base_controller.rb:163:in `disable_json_root'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.7.1/lib/audited/sweeper.rb:14:in `around'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:136:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/mapper.rb:48:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/static_dispatcher.rb:65:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/extractor/recorder.rb:137:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.14/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
/usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/tempfile_reaper.rb:15:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/etag.rb:25:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/conditional_get.rb:38:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/head.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:232:in `context'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:226:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/rack/logger.rb:28:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.13.0.rc1/lib/katello/prevent_json_parsing.rb:12:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
/opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.0.0/lib/secure_headers/middleware.rb:13:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `public_send'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/railties-5.2.1/lib/rails/railtie.rb:190:in `method_missing'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/urlmap.rb:68:in `block in call'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/rack-2.0.6/lib/rack/urlmap.rb:53:in `call'
/usr/share/passenger/phusion_passenger/rack/thread_handler_extension.rb:74:in `process_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:141:in `accept_and_process_next_request'
/usr/share/passenger/phusion_passenger/request_handler/thread_handler.rb:109:in `main_loop'
/usr/share/passenger/phusion_passenger/request_handler.rb:455:in `block (3 levels) in start_threads'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2019-08-30T01:42:11 [I|app|82078886]   Rendering api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout
2019-08-30T01:42:11 [I|app|82078886]   Rendered api/v2/errors/custom_error.json.rabl within api/v2/layouts/error_layout (0.5ms)
2019-08-30T01:42:11 [I|app|82078886] Completed 500 Internal Server Error in 152ms (Views: 1.2ms | ActiveRecord: 27.8ms)


Related issues 5 (0 open5 closed)

Related to Foreman - Feature #26092: When only one taxonomy of specific type is defined, api should default to that taxonomyClosedTomer BriskerActions
Related to Foreman - Bug #28122: Can't create a global parameter via hammerClosedTomer BriskerActions
Has duplicate Foreman - Bug #28007: Cannot create hostgroup parameter using the API via "python-foreman" module / hammer CLI in foreman 1.23DuplicateOleh FedorenkoActions
Has duplicate Foreman - Bug #27908: Set global-parameter fail with 500 Internal Server ErrorDuplicateActions
Has duplicate Foreman - Bug #28104: Cannot create SubnetParameter through API "unknown attribute 'organization_id' for SubnetParameter"DuplicateActions
Actions #1

Updated by Jo Vandeginste over 4 years ago

I have the same issue with hosts:

2019-10-07T15:46:15 [I|app|3f87ed74] Started POST "/api/hosts/9427/parameters" for [FILTERED] at 2019-10-07 15:46:15 +0200
2019-10-07T15:46:15 [I|app|3f87ed74] Processing by Api::V2::ParametersController#create as JSON
2019-10-07T15:46:15 [I|app|3f87ed74]   Parameters: {"parameter_type"=>"string", "value"=>"[FILTERED]", "name"=>"blub", "apiv"=>"v2", "host_id"=>"9427", "parameter"=>{"name"=>"blub", "value"=>"[FILTERED]"}}
2019-10-07T15:46:15 [I|app|3f87ed74] Authorized user lnxapi(api lnx )
2019-10-07T15:46:15 [W|app|3f87ed74] Action failed
 | ActiveModel::UnknownAttributeError: unknown attribute 'location_id' for HostParameter.
 | /foreman/vendor/ruby/2.5.0/gems/activemodel-5.2.1/lib/active_model/attribute_assignment.rb:53:in `_assign_attribute'
Actions #2

Updated by Jo Vandeginste over 4 years ago

I fixed it by running these SQL commands:

alter table parameters add column `organization_id` int(11) DEFAULT NULL;
alter table parameters add column `location_id` int(11) DEFAULT NULL;
alter table parameters add constraint `parameters_organization_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `taxonomies` (`id`);
alter table parameters add constraint `parameters_location_id_fk` FOREIGN KEY (`location_id`) REFERENCES `taxonomies` (`id`);
Actions #3

Updated by The Foreman Bot over 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7091 added
Actions #4

Updated by Tomer Brisker over 4 years ago

  • Has duplicate Bug #28007: Cannot create hostgroup parameter using the API via "python-foreman" module / hammer CLI in foreman 1.23 added
Actions #5

Updated by Tomer Brisker over 4 years ago

  • Related to Feature #26092: When only one taxonomy of specific type is defined, api should default to that taxonomy added
Actions #6

Updated by Tomer Brisker over 4 years ago

  • Target version set to 1.23.1
Actions #7

Updated by Oleh Fedorenko over 4 years ago

  • Has duplicate Bug #27908: Set global-parameter fail with 500 Internal Server Error added
Actions #8

Updated by The Foreman Bot over 4 years ago

  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/7122 added
Actions #9

Updated by Tomer Brisker over 4 years ago

  • Has duplicate Bug #28104: Cannot create SubnetParameter through API "unknown attribute 'organization_id' for SubnetParameter" added
Actions #10

Updated by The Foreman Bot over 4 years ago

  • Fixed in Releases 2.0.0 added
Actions #11

Updated by Tomer Brisker over 4 years ago

  • Fixed in Releases 1.24.0 added
  • Fixed in Releases deleted (2.0.0)
Actions #12

Updated by Tomer Brisker over 4 years ago

  • Fixed in Releases 1.23.1 added
Actions #13

Updated by Tomer Brisker over 4 years ago

  • Status changed from Ready For Testing to Closed
Actions #14

Updated by Tomer Brisker over 4 years ago

  • Has duplicate Bug #28122: Can't create a global parameter via hammer added
Actions #15

Updated by Tomer Brisker over 4 years ago

  • Has duplicate deleted (Bug #28122: Can't create a global parameter via hammer)
Actions #16

Updated by Tomer Brisker over 4 years ago

  • Related to Bug #28122: Can't create a global parameter via hammer added
Actions

Also available in: Atom PDF