Bug 1522769 - [V2] Regression in content view API
Summary: [V2] Regression in content view API
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: API - Content
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Partha Aji
QA Contact: Renzo Nuccitelli
URL:
Whiteboard:
: 1534468 (view as bug list)
Depends On:
Blocks: 1122832 1533259 1534215
TreeView+ depends on / blocked
 
Reported: 2017-12-06 12:19 UTC by Lukas Zapletal
Modified: 2019-08-12 14:07 UTC (History)
7 users (show)

Fixed In Version: tfm-rubygem-katello-3.4.5.47-1,tfm-rubygem-katello-3.4.5.53-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 22180 None None None 2018-01-08 21:31:32 UTC
Foreman Issue Tracker 22288 None None None 2018-01-16 16:59:07 UTC

Description Lukas Zapletal 2017-12-06 12:19:42 UTC
In Satellite 6.3, there is an API V2 breakage for content views.

A) components_ids are missing
B) repository_ids are empty (they were likely empty even in 6.2)

Can you guys discuss what would be the best approach for
handling this? I general, we must avoid doing breaking changes in the
API, if we want we can bump version to V3. I think there are two good
options - add the missing _ids back as deprecated options (to be
removed in V3) or waive the change making an upgrade note in our docs
if there is some kind of technical limitation to do the former.

[root@zzzap ~]# curl -sku admin:changeme https://$(hostname
-f):443/katello/api/v2/content_views/4 | json_reformat
{
    "content_host_count": 0,
    "composite": true,
    "repository_ids": [

    ],
    "default": false,
    "force_puppet_environment": false,
    "version_count": 1,
    "latest_version": "1.0",
    "id": 4,
    "name": "ccv-soe",
    "label": "ccv-soe",
    "description": null,
    "organization": {
        "name": "MyOrg",
        "label": "MyOrg",
        "id": 1
    },
    "created_at": "2017-12-04 12:10:51 UTC",
    "updated_at": "2017-12-04 12:11:06 UTC",
    "environments": [
        {
            "id": 1,
            "name": "Library",
            "label": "Library",
            "permissions": {
                "readable": true
            }
        }
    ],
    "repositories": [
        {
            "id": 12,
            "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server",
            "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server",
            "content_type": "yum"
        },
        {
            "id": 16,
            "name": "Red Hat Satellite Tools 6.2 for RHEL 6 Server RPMs x86_64",
            "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_6_Server_RPMs_x86_64",
            "content_type": "yum"
        },
        {
            "id": 14,
            "name": "Red Hat Satellite Tools 6.2 for RHEL 7 Server RPMs x86_64",
            "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_7_Server_RPMs_x86_64",
            "content_type": "yum"
        }
    ],
    "puppet_modules": [

    ],
    "versions": [
        {
            "id": 4,
            "version": "1.0",
            "published": "2017-12-04 12:11:06 UTC",
            "environment_ids": [
                1
            ]
        }
    ],
    "components": [
        {
            "id": 2,
            "name": "cv-rhel7 1.0",
            "content_view_id": 2,
            "version": "1.0",
            "puppet_module_count": 0,
            "environments": [
                {
                    "id": 1,
                    "name": "Library",
                    "label": "Library"
                }
            ],
            "content_view": {
                "id": 2,
                "name": "cv-rhel7",
                "label": "cv-rhel7",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0"
            },
            "repositories": [
                {
                    "id": 12,
                    "name": "Red Hat Enterprise Linux 7 Server RPMs
x86_64 7Server",
                    "label":
"Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server"
                }
            ]
        },
        {
            "id": 3,
            "name": "cv-tools 1.0",
            "content_view_id": 3,
            "version": "1.0",
            "puppet_module_count": 0,
            "environments": [
                {
                    "id": 1,
                    "name": "Library",
                    "label": "Library"
                }
            ],
            "content_view": {
                "id": 3,
                "name": "cv-tools",
                "label": "cv-tools",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0"
            },
            "repositories": [
                {
                    "id": 16,
                    "name": "Red Hat Satellite Tools 6.2 for RHEL 6
Server RPMs x86_64",
                    "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_6_Server_RPMs_x86_64"
                },
                {
                    "id": 14,
                    "name": "Red Hat Satellite Tools 6.2 for RHEL 7
Server RPMs x86_64",
                    "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_7_Server_RPMs_x86_64"
                }
            ]
        }
    ],
    "content_view_components": [
        {
            "latest": true,
            "id": 1,
            "created_at": "2017-12-04 12:10:56 UTC",
            "updated_at": "2017-12-04 12:10:56 UTC",
            "composite_content_view": {
                "id": 4,
                "name": "ccv-soe",
                "label": "ccv-soe",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view": {
                "id": 2,
                "name": "cv-rhel7",
                "label": "cv-rhel7",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view_version": {
                "id": 2,
                "name": "cv-rhel7 1.0",
                "content_view_id": 2,
                "version": "1.0",
                "puppet_module_count": 0,
                "content_view": {
                    "id": 2,
                    "name": "cv-rhel7",
                    "label": "cv-rhel7",
                    "description": null
                },
                "environments": [
                    {
                        "id": 1,
                        "name": "Library",
                        "label": "Library"
                    }
                ],
                "repositories": [
                    {
                        "id": 12,
                        "name": "Red Hat Enterprise Linux 7 Server
RPMs x86_64 7Server",
                        "label":
"Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server"
                    }
                ]
            }
        },
        {
            "latest": true,
            "id": 2,
            "created_at": "2017-12-04 12:10:56 UTC",
            "updated_at": "2017-12-04 12:10:56 UTC",
            "composite_content_view": {
                "id": 4,
                "name": "ccv-soe",
                "label": "ccv-soe",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view": {
                "id": 3,
                "name": "cv-tools",
                "label": "cv-tools",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view_version": {
                "id": 3,
                "name": "cv-tools 1.0",
                "content_view_id": 3,
                "version": "1.0",
                "puppet_module_count": 0,
                "content_view": {
                    "id": 3,
                    "name": "cv-tools",
                    "label": "cv-tools",
                    "description": null
                },
                "environments": [
                    {
                        "id": 1,
                        "name": "Library",
                        "label": "Library"
                    }
                ],
                "repositories": [
                    {
                        "id": 16,
                        "name": "Red Hat Satellite Tools 6.2 for RHEL
6 Server RPMs x86_64",
                        "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_6_Server_RPMs_x86_64"
                    },
                    {
                        "id": 14,
                        "name": "Red Hat Satellite Tools 6.2 for RHEL
7 Server RPMs x86_64",
                        "label":
"Red_Hat_Satellite_Tools_6_2_for_RHEL_7_Server_RPMs_x86_64"
                    }
                ]
            }
        }
    ],
    "activation_keys": [

    ],
    "next_version": "2.0",
    "last_published": "2017-12-04 12:11:06 UTC",
    "permissions": {
        "view_content_views": true,
        "edit_content_views": true,
        "destroy_content_views": true,
        "publish_content_views": true,
        "promote_or_remove_content_views": true


    }
}

Comment 3 David Davis 2017-12-06 16:42:21 UTC
The component_ids field missing is definitely a bug and I am not sure why that's happening given that it's in the code (see https://git.io/vbcEu). 

It looks like repository_ids captures repos that are directly associated with a content view whereas the 'repositories' field will either display repositories associated with a content view OR repos associated with a composite view's components (see https://git.io/vbcEC). I am not sure how to resolve this discrepancy.

Comment 5 Jonathon Turel 2018-01-08 21:31:29 UTC
Created redmine issue http://projects.theforeman.org/issues/22180 from this bug

Comment 7 Renzo Nuccitelli 2018-01-16 12:44:58 UTC
I've run some tests on Satellite 6.3 snap 32. First for a simple CV:

{
    "content_host_count": 0,
    "composite": false,
    "component_ids": [
        2
    ],
    "default": false,
    "force_puppet_environment": false,
    "version_count": 1,
    "latest_version": "1.0",
    "repository_ids": [
        1
    ],
    "id": 2,
    "name": "simple-cv",
    "label": "simple-cv",
    "description": null,
    "organization": {
        "name": "Default Organization",
        "label": "Default_Organization",
        "id": 1
    },
    "created_at": "2018-01-16 12:27:15 UTC",
    "updated_at": "2018-01-16 12:27:31 UTC",
    "environments": [
        {
            "id": 1,
            "name": "Library",
            "label": "Library",
            "permissions": {
                "readable": true
            }
        }
    ],
    "repositories": [
        {
            "id": 1,
            "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
            "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4",
            "content_type": "yum"
        }
    ],,
    "puppet_modules": [

    ],
    "versions": [
        {
            "id": 2,
            "version": "1.0",
            "published": "2018-01-16 12:27:31 UTC",
            "environment_ids": [
                1
            ]
        }
    ],
    "components": [

    ],


It has the correct repository_ids (1). component_ids has id 2 but the components itself is empty which seems a mismatch.

I have also tried a composite CV:

{
    "content_host_count": 0,
    "composite": true,
    "component_ids": [
        3
    ],
    "default": false,
    "force_puppet_environment": false,
    "version_count": 1,
    "latest_version": "1.0",
    "repository_ids": [
        2
    ],
    "id": 3,
    "name": "cv-composite",
    "label": "cv-composite",
    "description": null,
    "organization": {
        "name": "Default Organization",
        "label": "Default_Organization",
        "id": 1
    },
    "created_at": "2018-01-16 12:28:15 UTC",
    "updated_at": "2018-01-16 12:28:36 UTC",
    "environments": [
        {
            "id": 1,
            "name": "Library",
            "label": "Library",
            "permissions": {
                "readable": true
            }
        }
    ],
    "repositories": [
        {
            "id": 2,
            "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
            "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4",
            "content_type": "yum"
        }
    ],
    "puppet_modules": [

    ],
    "versions": [
        {
            "id": 3,
            "version": "1.0",
            "published": "2018-01-16 12:28:36 UTC",
            "environment_ids": [
                1
            ]
        }
    ],
    "components": [
        {
            "id": 2,
            "name": "simple-cv 1.0",
            "content_view_id": 2,
            "version": "1.0",
            "puppet_module_count": 0,
            "environments": [
                {
                    "id": 1,
                    "name": "Library",
                    "label": "Library"
                }
            ],
            "content_view": {
                "id": 2,
                "name": "simple-cv",
                "label": "simple-cv",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0"
            },
            "repositories": [
                {
                    "id": 2,
                    "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
                    "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4"
                }
            ]
        }
    ],
    "content_view_components": [
        {
            "latest": true,
            "id": 1,
            "created_at": "2018-01-16 12:28:22 UTC",
            "updated_at": "2018-01-16 12:28:22 UTC",
            "composite_content_view": {
                "id": 3,
                "name": "cv-composite",
                "label": "cv-composite",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view": {
                "id": 2,
                "name": "simple-cv",
                "label": "simple-cv",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view_version": {
                "id": 2,
                "name": "simple-cv 1.0",
                "content_view_id": 2,
                "version": "1.0",
                "puppet_module_count": 0,
                "content_view": {
                    "id": 2,
                    "name": "simple-cv",
                    "label": "simple-cv",
                    "description": null
                },
                "environments": [
                    {
                        "id": 1,
                        "name": "Library",
                        "label": "Library"
                    }
                ],
                "repositories": [
                    {
                        "id": 2,
                        "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
                        "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4"
                    }
                ]
            }
        }
    ],


Again the repository_ids has the matching id on repositories (2). Yet again component_id has a mismatching value (3) compared to components fields (2).

So I ask: what should be expected on component_ids for in both examples:

Comment 8 Partha Aji 2018-01-16 16:47:27 UTC
*** Bug 1534468 has been marked as a duplicate of this bug. ***

Comment 9 Partha Aji 2018-01-16 16:58:56 UTC
Connecting redmine issue http://projects.theforeman.org/issues/22288 from this bug

Comment 10 Partha Aji 2018-01-16 20:13:13 UTC
Connecting redmine issue http://projects.theforeman.org/issues/22288 from this bug

Comment 11 Partha Aji 2018-01-16 20:13:37 UTC
Connecting redmine issue http://projects.theforeman.org/issues/22288 from this bug

Comment 13 Renzo Nuccitelli 2018-01-25 16:09:19 UTC
Test performed on satellite 6.3 snap 34.

both repository_ids and component_ids are fine on simple CV:


{
    "content_host_count": 0,
    "composite": false,
    "component_ids": [

    ],
    "default": false,
    "force_puppet_environment": false,
    "version_count": 1,
    "latest_version": "1.0",
    "repository_ids": [
        1
    ],
    "id": 2,
    "name": "cv-simple",
    "label": "cv-simple",
    "description": null,
    "organization": {
        "name": "Default Organization",
        "label": "Default_Organization",
        "id": 1
    },
    "created_at": "2018-01-25 16:02:08 UTC",
    "updated_at": "2018-01-25 16:02:22 UTC",
    "environments": [
        {
            "id": 1,
            "name": "Library",
            "label": "Library",
            "permissions": {
                "readable": true
            }
        }
    ],
    "repositories": [
        {
            "id": 1,
            "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
            "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4",
            "content_type": "yum"
        }
    ],
    "puppet_modules": [

    ],
    "versions": [
        {
            "id": 2,
            "version": "1.0",
            "published": "2018-01-25 16:02:22 UTC",
            "environment_ids": [
                1
            ]
        }
    ],
    "components": [

    ],
    "content_view_components": [

    ],
    "activation_keys": [

    ],
    "next_version": "2.0",
    "last_published": "2018-01-25 16:02:22 UTC",
    "permissions": {
        "view_content_views": true,
        "edit_content_views": true,
        "destroy_content_views": true,
        "publish_content_views": true,
        "promote_or_remove_content_views": true
    }
}


And they are also consistent for composite CV:

{
    "content_host_count": 0,
    "composite": true,
    "component_ids": [
        2
    ],
    "default": false,
    "force_puppet_environment": false,
    "version_count": 1,
    "latest_version": "1.0",
    "repository_ids": [
        2
    ],
    "id": 3,
    "name": "cv-composite",
    "label": "cv-composite",
    "description": null,
    "organization": {
        "name": "Default Organization",
        "label": "Default_Organization",
        "id": 1
    },
    "created_at": "2018-01-25 16:03:09 UTC",
    "updated_at": "2018-01-25 16:03:27 UTC",
    "environments": [
        {
            "id": 1,
            "name": "Library",
            "label": "Library",
            "permissions": {
                "readable": true
            }
        }
    ],
    "repositories": [
        {
            "id": 2,
            "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
            "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4",
            "content_type": "yum"
        }
    ],
    "puppet_modules": [

    ],
    "versions": [
        {
            "id": 3,
            "version": "1.0",
            "published": "2018-01-25 16:03:27 UTC",
            "environment_ids": [
                1
            ]
        }
    ],
    "components": [
        {
            "id": 2,
            "name": "cv-simple 1.0",
            "content_view_id": 2,
            "version": "1.0",
            "puppet_module_count": 0,
            "environments": [
                {
                    "id": 1,
                    "name": "Library",
                    "label": "Library"
                }
            ],
            "content_view": {
                "id": 2,
                "name": "cv-simple",
                "label": "cv-simple",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0"
            },
            "repositories": [
                {
                    "id": 2,
                    "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
                    "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4"
                }
            ]
        }
    ],
    "content_view_components": [
        {
            "latest": true,
            "id": 1,
            "created_at": "2018-01-25 16:03:19 UTC",
            "updated_at": "2018-01-25 16:03:19 UTC",
            "composite_content_view": {
                "id": 3,
                "name": "cv-composite",
                "label": "cv-composite",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view": {
                "id": 2,
                "name": "cv-simple",
                "label": "cv-simple",
                "description": null,
                "next_version": 2,
                "latest_version": "1.0",
                "version_count": 1
            },
            "content_view_version": {
                "id": 2,
                "name": "cv-simple 1.0",
                "content_view_id": 2,
                "version": "1.0",
                "puppet_module_count": 0,
                "content_view": {
                    "id": 2,
                    "name": "cv-simple",
                    "label": "cv-simple",
                    "description": null
                },
                "environments": [
                    {
                        "id": 1,
                        "name": "Library",
                        "label": "Library"
                    }
                ],
                "repositories": [
                    {
                        "id": 2,
                        "name": "Red Hat Enterprise Linux 7 Server RPMs x86_64 7.4",
                        "label": "Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7_4"
                    }
                ]
            }
        }
    ],
    "activation_keys": [

    ],
    "next_version": "2.0",
    "last_published": "2018-01-25 16:03:27 UTC",
    "permissions": {
        "view_content_views": true,
        "edit_content_views": true,
        "destroy_content_views": true,
        "publish_content_views": true,
        "promote_or_remove_content_views": true
    }
}

Thus I'm moving this BZ to VERIFIED.

Comment 14 pm-sat@redhat.com 2018-02-21 16:54:17 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-2018:0336


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