Bug 1765610

Summary: Content View publish does not return a meaningful result in the task output
Product: Red Hat Satellite Reporter: Evgeni Golov <egolov>
Component: API - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Jitendra Yejare <jyejare>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.6.0CC: fgarciad, pcreech
Target Milestone: 6.7.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.14.0-0.4.rc2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-14 13:26:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Evgeni Golov 2019-10-25 15:01:50 UTC
When you call <code>/katello/api/content_views/:id/publish</code>, you get a ForemanTask, that you can poll until it's done and then analyze the result (e.g. because you now want to promote the freshly generated version to a LCE).

In 3.12.3, the result looks like this:

<pre>
{'action': 'Publish content view Test Content View; organization Test Organization',
 'cli_example': None,
 'ended_at': '2019-10-25 13:16:47 UTC',
 'humanized': {'action': 'Publish',
                'errors': [],
                'input': [['conte  nt_view',
                            {'link': '/content_views/3/versions',
                             'text': 'content view Test Content View'}],
                           ['organization',
                            {'link': '/organizations/3/edit',
                             'text': 'organization Test Organization'}]],
                'output': ''},
 'id': 'a0b0cd56-3274-4026-bd8e-db6885593566',
 'input': {'content_view': {'id': 3,
                              'label': 'Test_Content_View',
                              'name': 'Test Content View'},
            'content_view_id': 3,
            'content_view_version_id': 3,
            'current_location_id': None,
            'current_organization_id': None,
            'current_request_id': None,
            'current_timezone': 'UTC',
            'current_user_i  d': 4,
            'environment_id': 2,
            'history_id': 1,
            'organization': {'id': 3,
                              'label': 'Test_Organization',
                              'name': 'Test Organization'},
            'services_checked': ['candlepin',
                                  'candlepin_auth',
                                  'pulp',
                                  'pulp_auth'],
            'user_id': 4},
 'label': 'Actions::Katello::ContentView::Publish',
 'output': {'composite_auto_publish_task_id': [],
             'composite_version_auto_published': [],
             'composite_view_publish_failed': [],
             'content_view_id': 3,
             'content_view_version_id': 3},
 'pending': False,
 'progress': 1.0,
 'result': 'success',
 'started_at': '2019-10-25 13:16:39 UTC',
 'state': 'stopped',
 'username': 'admin'}
</pre>

However, on 3.13.1 it looks like this:

<pre>
{'action': 'Publish content view Test Content View; organization Test Organization',
 'cli_example': None,
 'ended_at': '2019-10-25 12:33:05 UTC',
 'humanized': {'action': 'Publish',
                'errors': [],
                'input': [['content_vi  ew',
                            {'link': '/content_views/3/versions',
                             'text': 'content view Test Content View'}],
                           ['organization',
                            {'link': '/organizations/3/edit',
                             'text': 'organization Test Organization'}]],
                'output': ''},
 'id': '47e4cfd6-ed86-4957-af6a-ea74b4205b62',
 'input': {'auto_publish_composite_ids': [],
            'content_view': {'id': 3,
                              'label': 'Test_Content_View',
                              'name': 'Test Content View'},
            'content_view_id': 3,
            'content_view_version_id': 5,
            'content_view_version_name': 'Test Content View 1.0',
            'current_location_id': None,
            'current_organization_id': None,
            'current_request_id': None,
            'current_timezone': 'UTC',
            'current_user_id': 4,
            'environment_id': 2,
            'history_id': 7,
            'organization': {'id': 3,
                              'label': 'Test_Organization',
                              'name': 'Test Organization'},
            'services_checked': ['candlepin',
                                  'candlepin_auth',
                                  'pulp',
                                  'pulp_auth'],
            'user_id': 4},
 'label': 'Actions::Katello::ContentView::Publish',
 'output': {},
 'pending': False,
 'progress': 1.0,
 'result': 'success',
 'started_at': '2019-10-25 12:32:57 UTC',
 'state': 'stopped',
 'username': 'admin'}
</pre>

See how the <code>output</code> section is empty?

Technically, I could look at the <code>input</code> as it also contains the <code>content_view_version_id</code> I care about, but it kinda feels weird to look at the task input rather output.

Comment 1 Evgeni Golov 2019-10-25 15:01:54 UTC
Created from redmine issue https://projects.theforeman.org/issues/28138

Comment 2 Evgeni Golov 2019-10-25 15:01:57 UTC
Upstream bug assigned to None

Comment 7 Jitendra Yejare 2019-12-13 07:50:15 UTC
Verified!


@Satellite 6.6 snap 5
@Katello 3.14.0.0.4

Steps:
-----------
1. Create a content View with some repository.
2. Publish the content view.
3. Remeber/Retrieve the task id for CV publish foreman task.
4. After CV publish is finished, check the output value by GETting the task info.


Observation:
-------------
1. The output value is displayed for the finished cv publish task.


Logs:
-----

# curl -u admin:changeme -X GET https://sathost.com/foreman_tasks/api/tasks/371fd13e-ed83-4093-9165-f97e90f92192 --insecure
{
  "id": "371fd13e-ed83-4093-9165-f97e90f92192",
  "label": "Actions::Katello::ContentView::Publish",
  "pending": false,
  "action": "Publish content view 'testug_cv'; organization 'Default Organization'",
  "username": "admin",
  "started_at": "2019-12-13 07:00:06 UTC",
  "ended_at": "2019-12-13 07:25:09 UTC",
  "state": "stopped",
  "result": "success",
  "progress": 1.0,
  "input": {
    "content_view": {
      "id": 2,
      "name": "testug_cv",
      "label": "testug_cv"
    },
    "organization": {
      "id": 1,
      "name": "Default Organization",
      "label": "Default_Organization"
    },
    "history_id": 1,
    "content_view_id": 2,
    "auto_publish_composite_ids": [
      
    ],
    "content_view_version_name": "testug_cv 1.0",
    "content_view_version_id": 2,
    "environment_id": 1,
    "user_id": 4,
    "current_request_id": null,
    "current_timezone": "Asia/Kolkata",
    "current_user_id": 4,
    "current_organization_id": 1,
    "current_location_id": 2
  },
  "output": {
    "content_view_id": 2,
    "content_view_version_id": 2
  },
  "humanized": {
    "action": "Publish",
    "input": [
      [
        "content_view",
        {
          "text": "content view 'testug_cv'",
          "link": "/content_views/2/versions"
        }
      ],
      [
        "organization",
        {
          "text": "organization 'Default Organization'",
          "link": "/organizations/1/edit"
        }
      ]
    ],
    "output": "",
    "errors": [
      
    ]
  },
  "cli_example": null,
  "available_actions": {
    "cancellable": false,
    "resumable": false
  }
}

Comment 8 Jitendra Yejare 2019-12-13 07:51:06 UTC
Modifying the above comment for following:

@Satellite 6.7 snap 5

Comment 11 errata-xmlrpc 2020-04-14 13:26:02 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://access.redhat.com/errata/RHSA-2020:1454