Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Insights Remediation playbook fails with error "Failed to create job. Ensure your systems are registered in Foreman" when system hostname has uppercase characters
Description of problem:
This bug is when system registered to satellite has Uppercase characters like CLIENT.example.com. Satellite converts the hostname in lower case before saving into database but insights registration accepts upper case characters. This causes a resolution issue in code :
File : /opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.2.0/app/models/redhat_access/concerns/host_managed_extensions.rb
Line : host_ids = Host::Managed.where(:name => hostname_rules_relation.keys).pluck(:id)
Abov search is case sensitive and remdeiation fials with error :
===========
2019-05-07T09:38:31 [E|bac|59729] PG::SyntaxError: ERROR: syntax error at or near ")"
LINE 1: ... "hosts"."organization_id" = 4 AND (( hosts.id IN())) ORDER ...
^
: SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."organization_id" = 4 AND (( hosts.id IN())) ORDER BY "hos
ts"."name" ASC (ActiveRecord::StatementInvalid)
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `async_exec'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `block (2 levels) in exec_no_cache'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:185:in `yield_shares'
===========
Version-Release number of selected component (if applicable):
6.4
6.5
How reproducible:
Always
Steps to Reproduce:
1. Register a system with satellite which has uppercase characters in hostname. Also register the same to insights
2. Run a remeditaion playbook and it will fail
Additional info:
A workaround is to re register the system with insights with lowercase characters
# insights-client --force-reregister --display-name $(hostname -f | tr [A-Z] [a-z])
Still reproducible in Satellite 6.9 snap 17 tfm-rubygem-redhat_access-2.2.19
Steps:
- on host, modify hostname so that it contains uppercase characters
- register host to satellite using global registration dialog with insights setting enabled
- after successful registration, observe the hostname appears upcased in the insights overview, but downcased in the hosts list
- create a remediation playbook and plan for the host
When clicking Run Playbook in the Plans detail view, a popup appears:
Failed to create job. Ensure your systems are registered in Foreman
If using Customized Playbook run, and submitting the rex job, the result is red screen with:
Oops, we're sorry but something went wrong PG::SyntaxError: ERROR: syntax error at or near "vms" LINE 1: ...location_id" = $3 AND (( hosts.name IN(<hostname>... ^
Prodlog excrept in attachment.
Confiming the changes from associated github pr landed with tfm-rubygem-redhat_access-2.2.19
Going to move this out of 6.9 to 6.10 where we are fully removing the old legacy access plugin and will have this solved when remediations are handled by the new cloud plugin.
Verified on Satellite 6.10 snap 23 using steps from the comment 11, registered host now appears with downcased hostname in the remediation list, remediation job is executed successfully
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 (Moderate: Satellite 6.10 Release), 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://access.redhat.com/errata/RHSA-2021:4702
Description of problem: This bug is when system registered to satellite has Uppercase characters like CLIENT.example.com. Satellite converts the hostname in lower case before saving into database but insights registration accepts upper case characters. This causes a resolution issue in code : File : /opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.2.0/app/models/redhat_access/concerns/host_managed_extensions.rb Line : host_ids = Host::Managed.where(:name => hostname_rules_relation.keys).pluck(:id) Abov search is case sensitive and remdeiation fials with error : =========== 2019-05-07T09:38:31 [E|bac|59729] PG::SyntaxError: ERROR: syntax error at or near ")" LINE 1: ... "hosts"."organization_id" = 4 AND (( hosts.id IN())) ORDER ... ^ : SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."organization_id" = 4 AND (( hosts.id IN())) ORDER BY "hos ts"."name" ASC (ActiveRecord::StatementInvalid) /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `async_exec' /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/postgresql_adapter.rb:616:in `block (2 levels) in exec_no_cache' /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads' /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.6/lib/active_support/concurrency/share_lock.rb:185:in `yield_shares' =========== Version-Release number of selected component (if applicable): 6.4 6.5 How reproducible: Always Steps to Reproduce: 1. Register a system with satellite which has uppercase characters in hostname. Also register the same to insights 2. Run a remeditaion playbook and it will fail Additional info: A workaround is to re register the system with insights with lowercase characters # insights-client --force-reregister --display-name $(hostname -f | tr [A-Z] [a-z])