Bug 1209015 - Accessing the enabled_tcp_inbound_ports virtual column of a MiqAeServiceHostRedhat gives a <NoMethodError>: <undefined method `find_all_by_enabled_and_protocol_and_direction' for [ ]:ActiveRecord::Relation>
Summary: Accessing the enabled_tcp_inbound_ports virtual column of a MiqAeServiceHostR...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.3.0
Hardware: All
OS: All
unspecified
medium
Target Milestone: GA
: 5.4.0
Assignee: mkanoor
QA Contact: Dave Johnson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-05 08:45 UTC by Peter McGowan
Modified: 2019-12-16 04:42 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-16 12:56:52 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:1100 0 normal SHIPPED_LIVE CFME 5.4.0 bug fixes, and enhancement update 2015-06-16 16:28:42 UTC

Description Peter McGowan 2015-04-05 08:45:39 UTC
Description of problem:
A MiqAeServiceHostRedhat object has four virtual columns:

  enabled_tcp_inbound_ports
  enabled_tcp_outbound_ports
  enabled_udp_inbound_ports
  enabled_udp_outbound_ports

however when any of these is accessed an exception is raised:

<NoMethodError>: <undefined method `find_all_by_enabled_and_protocol_and_direction' for [
]:ActiveRecord::Relation>

Each of these methods calls self.get_ports, which contains the code:

  def get_ports(*args)
    return [] if self.operating_system.nil?
    if args.length == 3
      rules = self.operating_system.firewall_rules.find_all_by_enabled_and_protocol_and_direction(*args)

...however the firewall_rules table doesn't seem to have a 'protocol' column:

vmdb_production=# \d firewall_rules
                                            Table "public.firewall_rules"
          Column          |            Type             |                          Modifiers
--------------------------+-----------------------------+-------------------------------------------------------------
 id                       | bigint                      | not null default nextval('firewall_rules_id_seq'::regclass)
 name                     | character varying(255)      |
 display_name             | character varying(255)      |
 group                    | character varying(255)      |
 enabled                  | boolean                     |
 required                 | boolean                     |
 host_protocol            | character varying(255)      |
 direction                | character varying(255)      |
 port                     | integer                     |
 end_port                 | integer                     |
 created_on               | timestamp without time zone |
 updated_on               | timestamp without time zone |
 resource_id              | bigint                      |
 resource_type            | character varying(255)      |
 source_security_group_id | bigint                      |
 source_ip_range          | character varying(255)      |
 ems_ref                  | character varying(255)      |
 network_protocol         | character varying(255)      |
Indexes:
    "firewall_rules_pkey" PRIMARY KEY, btree (id)
    "index_firewall_rules_on_resource_id_and_resource_type" btree (resource_id, resource_type)


Version-Release number of selected component (if applicable):
5.3.3

How reproducible:
Every time

Additional info:

Comment 2 Greg McCullough 2015-04-06 14:45:29 UTC
Migration 20140214191729_enhance_firewall_rules_for_neutron_networking.rb renamed the protocol column to host_protocol.  The get_ports method in the host.rb file needs to be updated to use the new column name.

Comment 3 CFME Bot 2015-04-07 17:51:19 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/c3e0af2e291e001bc5590eb09440ad8510076efd

commit c3e0af2e291e001bc5590eb09440ad8510076efd
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Mon Apr 6 14:16:56 2015 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Tue Apr 7 12:28:05 2015 -0400

    Fixed the function name to include _host
    
    Added a spec and fixed the function name
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1209015

 vmdb/app/models/host.rb       |  6 +++---
 vmdb/spec/models/host_spec.rb | 25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)

Comment 5 Pete Savage 2015-04-28 10:39:10 UTC
Verified in 5.4.0.0.22.20150420163946

Comment 7 errata-xmlrpc 2015-06-16 12:56:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1100.html


Note You need to log in before you can comment on or make changes to this bug.