Bug #25836
openAPI permits removal of "primary" property from interface; blocks all further management of interface
Description
Issued an API PUT call to "hosts/<ID>/interfaces/<ID>" to set the "primary" property to False (in an effort to try to delete and recreate the interface). The request to change the property succeeded, but now all subsequent attempts to interact with the interface configuration by both API and web UI (including trying to delete it) fail with a stackdump:
Host::Base#name= delegated to primary_interface.name=, but primary_interface is nil: #<Host::Managed id: 2, name: "host.test.net", last_compile: nil, last_report: nil, updated_at: "2019-01-10 19:38:20", created_at: "2018-11-30 17:50:48", root_pass: "$6$W70vlsDdvYVn1HWk$DxeH/luGjTFfPsoc6WiJd8Eeubl580...", architecture_id: 1, operatingsystem_id: 2, environment_id: 1, ptable_id: 99, medium_id: 10, build: false, comment: "", disk: "", installed_at: "2018-11-30 21:05:38", model_id: 2, hostgroup_id: nil, owner_id: 4, owner_type: "User", enabled: true, puppet_ca_proxy_id: 1, managed: true, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: 1, certname: nil, image_id: nil, organization_id: 1, location_id: 3, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "PASS", global_status: 0, lookup_value_matcher: "fqdn=host.test.net", pxe_loader: "Grub2 UEFI", initiated_at: "2018-11-30 20:56:22", build_errors: nil, discovery_rule_id: nil>