Project

General

Profile

Actions

Bug #38033

open

Foreman REST API unable to associate Template Proxy with Subnets

Added by Eli Courtwright 5 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

I'm using the Foreman REST API to associate Smart Proxies with the correct Domains and Subnets. The REST API is able to do this for DNS on Domains, Reverse DNS on Subnets, and both TFTP and DHCP on Subnets.

However, when I try to use the API to set the template_id field on a Subnet, I get an error. Here's the simplest possible test script to demonstrate what I mean:

import json
import requests

with open('/etc/foreman/sync-config.json') as f:
    settings = json.load(f)

session = requests.Session()
session.headers['Content-Type'] = 'application/json'
session.auth = (settings['username'], settings['access_token'])

# Associating a subnet with a DNS smart proxy works.  (So does DHCP and TFTP, which are not shown here.)
response = session.put(f'https://{settings["foreman_server"]}/api/v2/subnets/11', data=json.dumps({'dns_id': 2}))
assert 200 <= response.status_code <= 299

# Trying to associate a subnet with a Template Proxy fails.
response = session.put(f'https://{settings["foreman_server"]}/api/v2/subnets/11', data=json.dumps({'template_id': 3}))
print(response.status_code)
print(response.content.decode('UTF-8'))

When run, this code properly works for the DNS association but fails on associating a Template Proxy:

# python3 bugreport.py 
500
{
  "error": {"message":"PG::UndefinedTable: ERROR:  missing FROM-clause entry for table \"templates\"\nLINE 1: ...art_proxies\".\"id\" = \"subnets\".\"template_id\" WHERE \"templates...\n                                                             ^\n"}
}

I checked the Foreman logs and see the same error with some additional information, none of which seems to shed any light:

2024-11-21T16:36:07 [I|app|c86393d0] Started PUT "/api/v2/subnets/11" for 10.0.76.41 at 2024-11-21 16:36:07 +0000
2024-11-21T16:36:07 [I|app|c86393d0] Processing by Api::V2::SubnetsController#update as JSON
2024-11-21T16:36:07 [I|app|c86393d0]   Parameters: {"template_id"=>3, "apiv"=>"v2", "id"=>"11", "subnet"=>{"template_id"=>3}}
2024-11-21T16:36:07 [W|app|c86393d0] Action failed
2024-11-21T16:36:07 [I|app|c86393d0] Backtrace for 'Action failed' error (ActiveRecord::StatementInvalid): PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "templates" 
 c86393d0 | LINE 1: ...art_proxies"."id" = "subnets"."template_id" WHERE "templates...
 c86393d0 |                                                              ^
 c86393d0 | 
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `exec_params'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql_adapter.rb:672:in `block (2 levels) in exec_no_cache'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `block in exec_no_cache'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql_adapter.rb:670:in `exec_no_cache'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql_adapter.rb:649:in `execute_and_clear'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:55:in `exec_query'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/database_statements.rb:532:in `select'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/database_statements.rb:69:in `select_all'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/query_cache.rb:101:in `block in select_all'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/query_cache.rb:118:in `block in cache_sql'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/query_cache.rb:109:in `cache_sql'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/query_cache.rb:101:in `select_all'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/connection_adapters/abstract/database_statements.rb:95:in `select_rows'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:320:in `block in exists?'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation.rb:861:in `skip_query_cache_if_necessary'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/finder_methods.rb:320:in `exists?'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation.rb:266:in `empty?'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation.rb:278:in `any?'
 c86393d0 | /usr/share/foreman/app/controllers/api/base_controller.rb:92:in `parent_scope'
 c86393d0 | /usr/share/foreman/app/controllers/api/base_controller.rb:74:in `resource_scope'
 c86393d0 | /usr/share/foreman/app/controllers/concerns/find_common.rb:8:in `find_resource'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:427:in `block in make_lambda'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:179:in `block (2 levels) in halting_and_conditional'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:180:in `block in halting_and_conditional'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `block in invoke_before'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `each'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:512:in `invoke_before'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:115:in `block in run_callbacks'
 c86393d0 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 c86393d0 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 c86393d0 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 c86393d0 | /usr/share/gems/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 c86393d0 | /usr/share/gems/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:137:in `run_callbacks'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/callbacks.rb:41:in `process_action'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/rescue.rb:22:in `process_action'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `block in instrument'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/notifications.rb:203:in `instrument'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 c86393d0 | /usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/abstract_controller/base.rb:165:in `process'
 c86393d0 | /usr/share/gems/gems/actionview-6.1.7.8/lib/action_view/rendering.rb:39:in `process'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:190:in `dispatch'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_controller/metal.rb:254:in `dispatch'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/mapper.rb:49:in `serve'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `each'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/journey/router.rb:32:in `serve'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/routing/route_set.rb:842:in `call'
 c86393d0 | /usr/share/gems/gems/apipie-dsl-2.6.2/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 c86393d0 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/static_dispatcher.rb:74:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/static.rb:24:in `call'
 c86393d0 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 c86393d0 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 c86393d0 | /usr/share/gems/gems/apipie-rails-1.4.2/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/conditional_get.rb:40:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 c86393d0 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/cookies.rb:697:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/callbacks.rb:98:in `run_callbacks'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 c86393d0 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:37:in `call_app'
 c86393d0 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/rack/logger.rb:28:in `call'
 c86393d0 | /usr/share/gems/gems/sprockets-rails-3.5.2/lib/sprockets/rails/quiet_assets.rb:17:in `call'
 c86393d0 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
 c86393d0 | /usr/share/gems/gems/activesupport-6.1.7.8/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/executor.rb:14:in `call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 c86393d0 | /usr/share/gems/gems/actionpack-6.1.7.8/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 c86393d0 | /usr/share/gems/gems/secure_headers-6.7.0/lib/secure_headers/middleware.rb:11:in `call'
 c86393d0 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/engine.rb:539:in `call'
 c86393d0 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `public_send'
 c86393d0 | /usr/share/gems/gems/railties-6.1.7.8/lib/rails/railtie.rb:207:in `method_missing'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
 c86393d0 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/configuration.rb:272:in `call'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:100:in `block in handle_request'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/request.rb:99:in `handle_request'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:464:in `process_client'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/server.rb:245:in `block in run'
 c86393d0 | /usr/share/gems/gems/puma-6.4.2/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
 c86393d0 | /usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2024-11-21T16:36:07 [I|app|c86393d0]   Rendered api/v2/errors/standard_error.json.rabl within api/v2/layouts/error_layout (Duration: 0.4ms | Allocations: 118)
2024-11-21T16:36:07 [I|app|c86393d0]   Rendered layout api/v2/layouts/error_layout.json.erb (Duration: 0.6ms | Allocations: 212)
2024-11-21T16:36:07 [I|app|c86393d0] Completed 500 Internal Server Error in 13ms (Views: 1.1ms | ActiveRecord: 3.0ms | Allocations: 3130)

I made sure that template_id is the correct field - when I use the Foreman UI to make the Template Proxy association, this is the field that is set. I was even able to manually run the SQL command:

UPDATE subnets SET template_id = 1 WHERE id = 11;

and this did correctly associate the Template Proxy with the subnet. So the issue does appear to be with the API itself.

I checked the subnets database table and found that for some reason, the other smart proxies are defined as foreign keys but the template_id (and httpbood_id) columns are not:

foreman=# \d subnets
                                            Table "public.subnets" 
       Column       |            Type             | Collation | Nullable |               Default               
--------------------+-----------------------------+-----------+----------+-------------------------------------
 id                 | integer                     |           | not null | nextval('subnets_id_seq'::regclass)
 network            | character varying(45)       |           |          | 
 mask               | character varying(45)       |           |          | 
 priority           | integer                     |           |          | 
 name               | text                        |           |          | 
 vlanid             | integer                     |           |          | 
 created_at         | timestamp without time zone |           |          | 
 updated_at         | timestamp without time zone |           |          | 
 dhcp_id            | integer                     |           |          | 
 tftp_id            | integer                     |           |          | 
 gateway            | character varying(45)       |           |          | 
 dns_primary        | character varying(45)       |           |          | 
 dns_secondary      | character varying(45)       |           |          | 
 from               | character varying(45)       |           |          | 
 to                 | character varying(45)       |           |          | 
 dns_id             | integer                     |           |          | 
 boot_mode          | character varying           |           | not null | 'DHCP'::character varying
 ipam               | character varying(255)      |           | not null | 'None'::character varying
 type               | character varying           |           | not null | 'Subnet::Ipv4'::character varying
 description        | text                        |           |          | 
 mtu                | bigint                      |           | not null | 1500
 template_id        | integer                     |           |          | 
 httpboot_id        | integer                     |           |          | 
 nic_delay          | integer                     |           |          | 
 externalipam_id    | integer                     |           |          | 
 externalipam_group | text                        |           |          | 
 bmc_id             | integer                     |           |          | 
Indexes:
    "subnets_pkey" PRIMARY KEY, btree (id)
    "index_subnets_on_externalipam_id" btree (externalipam_id)
    "index_subnets_on_httpboot_id" btree (httpboot_id)
    "index_subnets_on_name" UNIQUE, btree (name)
    "index_subnets_on_type" btree (type)
Foreign-key constraints:
    "subnets_dhcp_id_fk" FOREIGN KEY (dhcp_id) REFERENCES smart_proxies(id)
    "subnets_dns_id_fk" FOREIGN KEY (dns_id) REFERENCES smart_proxies(id)
    "subnets_tftp_id_fk" FOREIGN KEY (tftp_id) REFERENCES smart_proxies(id)

Given that we have dhcp_id , dns_id , and tftp_id defined as foreign keys, I would expect to also see similar definitions for template_id and httpboot_id.

I'm not 100% sure that this would fix the API issue, but I suspect the Ruby code is using the foreign key definitions to determine what should happen when these fields are set, and that's causing the issue here.

Unfortunately, I'm a Python developer and only somewhat familiar with Ruby, so I don't feel qualified to dive into the codebase to attempt a fix, but hopefully this is enough detail to be able to reproduce the issue and determine a root cause.


Related issues 1 (1 open0 closed)

Related to Foreman - Tracker #38276: Foreman Provisioning Interest GroupNewLeos Stejskal

Actions
Actions #1

Updated by Eli Courtwright about 1 month ago

  • Found in Releases 3.13.0 added
Actions #2

Updated by Leos Stejskal about 1 month ago

  • Related to Tracker #38276: Foreman Provisioning Interest Group added
Actions

Also available in: Atom PDF