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.
Bug 2008095 - Getting "undefined method `[]' for true:TrueClass" error when creating a new remote for a new repo.
Summary: Getting "undefined method `[]' for true:TrueClass" error when creating a new ...
Keywords:
Status: CLOSED DUPLICATE of bug 1998566
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Repositories
Version: 6.10.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.10.0
Assignee: satellite6-bugs
QA Contact: Cole Higgins
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-27 09:24 UTC by Hao Chang Yu
Modified: 2021-09-27 13:33 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-09-27 13:33:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Hao Chang Yu 2021-09-27 09:24:33 UTC
Description of problem:
Getting the following error when trying to add a remote url for a newly created repository.

8: Actions::Pulp3::Repository::UpdateRemote (error) [ 6.70s / 6.70s ] Skip
...
Execution time (excluding suspended state): 6.70s

Input:

---
repository_id: 4
smart_proxy_id: 1
remote_user: admin
remote_cp_user: admin
current_request_id: 9b93e946-f7df-44f3-91ae-87f5f8df596a
current_timezone: Australia/Brisbane
current_organization_id: 1
current_location_id: 2
current_user_id: 4
Output:

--- {}
Error:

NoMethodError

undefined method `[]' for true:TrueClass

---
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/services/katello/pulp3/task.rb:45:in
  `initialize'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:62:in
  `new'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:62:in
  `block in new_or_existing_objects'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:58:in
  `map'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:58:in
  `new_or_existing_objects'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:110:in
  `external_task='"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/polling.rb:84:in
  `initiate_external_action'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/polling.rb:19:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action/cancellable.rb:14:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/pulp3/abstract_async_task.rb:10:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/action.rb:572:in
  `block (3 levels) in execute_run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:27:in
  `pass'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware.rb:19:in
  `pass'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware.rb:32:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:23:in
  `call'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:27:in
  `pass'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware.rb:19:in
  `pass'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/middleware/remote_action.rb:16:in
  `block in run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/middleware/remote_action.rb:40:in
  `block in as_remote_user'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/models/katello/concerns/user_extensions.rb:21:in
  `cp_config'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/middleware/remote_action.rb:27:in
  `as_cp_user'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/middleware/remote_action.rb:39:in
  `as_remote_user'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.15/app/lib/actions/middleware/remote_action.rb:16:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:23:in
  `call'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware/stack.rb:27:in
  `pass'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.9/lib/dynflow/middleware.rb:19:in


Steps to Reproduce:
1. In Satellite Web UI, create a new custom Yum repository without filling the Upstream url.
2. Go to the repository page and then edit the Upstream url and save it.

Actual results:
Task failed with "NoMethodError undefined method `[]' for true:TrueClass" error

Expected results:
No error

Additional info:
This is because the UpdateRemote action is expecting a task but "create_remote" is not async.

# In app/services/katello/pulp3/repository.rb

      def create_remote
        remote_file_data = api.class.remote_class.new(remote_options)
        reformat_api_exception do
          response = api.remotes_api.create(remote_file_data)
          repo.update!(:remote_href => response.pulp_href)  <================ returned true
        end
      end

Comment 1 Justin Sherrill 2021-09-27 13:33:09 UTC
this was fixed in  tfm-rubygem-katello-4.1.1.21-1

*** This bug has been marked as a duplicate of bug 1998566 ***


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