Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes 4952: add snaps list with temp list/fetch #874

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jlsherrill
Copy link
Member

@jlsherrill jlsherrill commented Nov 5, 2024

Summary

Adds snapshot list to template list and fetch api calls.

Testing steps

  1. Create a repository, let it snapshot
  2. Create a template with that repository:
####
POST http://localhost:8000/api/content-sources/v1.0/templates/
x-rh-identity: eyJpZGVudGl0eSI6eyJvcmdfaWQiOiI5IiwgInR5cGUiOiJVc2VyIiwidXNlciI6eyJ1c2VybmFtZSI6ImZvbyJ9LCJhY2NvdW50X251bWJlciI6ImZvbyIsImludGVybmFsIjp7Im9yZ19pZCI6IjkifX19Cg==
Content-Type: application/json

{
  "name":"test3",
  "arch": "x86_64",
  "version": "9",
  "repository_uuids": ["48b89a40-7d3d-4bd8-8596-f20d77c42032"],
  "date": "2024-09-10T15:09:43-04:00"
}
  1. Fetch/list the template and see the snapshot list:

{
  "data": [
    {
      "uuid": "01bc2b42-b74c-47f4-a9bd-1da2e8b3e941",
      "name": "test3",
      "org_id": "9",
      "description": "",
      "arch": "x86_64",
      "version": "9",
      "date": "2024-09-10T19:09:43Z",
      "repository_uuids": [
        "48b89a40-7d3d-4bd8-8596-f20d77c42032"
      ],
      "snapshots": [
        {
          "uuid": "4c8a35e0-56d4-46bb-b875-2463a954c6cc",
          "created_at": "2024-11-04T13:50:19.182357Z",
          "repository_path": "48e64014/48b89a40-7d3d-4bd8-8596-f20d77c42032/78f2a819-46c8-4188-8403-dfe3f145180d",
          "content_counts": {
            "rpm.advisory": 1235,
            "rpm.package": 7326,
            "rpm.packagecategory": 4,
            "rpm.packageenvironment": 3,
            "rpm.packagegroup": 34,
            "rpm.repo_metadata_file": 1
          },
          "added_counts": {
            "rpm.advisory": 1235,
            "rpm.package": 7326,
            "rpm.packagecategory": 4,
            "rpm.packageenvironment": 3,
            "rpm.packagegroup": 34,
            "rpm.repo_metadata_file": 1
          },
          "removed_counts": {},
          "url": "",
          "repository_name": "",
          "repository_uuid": ""
        }
      ],
      "rhsm_environment_id": "01bc2b42b74c47f4a9bd1da2e8b3e941",
      "created_by": "foo",
      "last_updated_by": "foo",
      "created_at": "2024-11-05T20:10:36.695726Z",
      "updated_at": "2024-11-05T20:10:36.695726Z",
      "use_latest": false,
      "last_update_snapshot_error": "",
      "last_update_task_uuid": "9fe2020f-6499-40b1-9723-43385fccbf22",
      "last_update_task": {
        "uuid": "9fe2020f-6499-40b1-9723-43385fccbf22",
        "status": "failed",
        "created_at": "2024-11-05T20:13:37Z",
        "ended_at": "2024-11-05T20:13:37Z",
        "error": "",
        "org_id": "9",
        "type": "update-template-content",
        "object_type": "template",
        "object_name": "test3",
        "object_uuid": "01bc2b42-b74c-47f4-a9bd-1da2e8b3e941"
      },
      "rhsm_environment_created": true
    }
  ],
  "meta": {
    "limit": 100,
    "offset": 0,
    "count": 1
  },
  "links": {
    "first": "/api/content-sources/v1.0/templates/?limit=100&offset=0",
    "last": "/api/content-sources/v1.0/templates/?limit=100&offset=0"
  }
}

One thing to note is that the snapshot list isn't populated at creation time, but instead via the update_content_template task. I'm not sure we can do much at this time about it.

@jlsherrill
Copy link
Member Author

note this includes some changes from #865 so that will have to go in first and this be rebased.

@jlsherrill
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant