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

Add new verify_checksum endpoints #1138

Merged
merged 2 commits into from
May 21, 2024

Conversation

vsedmik
Copy link
Contributor

@vsedmik vsedmik commented Apr 19, 2024

Description of changes
  1. New endpoints are gonna be added in 6.16.
  2. Two already existing endpoints are not supported.
Upstream API documentation, plugin, or feature links
  1. New ones:
    stream.satellite.com/apidoc/v2/capsule_content/verify_checksum.en.html
    stream.satellite.com/apidoc/v2/content_view_versions/verify_checksum.en.html
  2. Existing ones:
    any.satellite.com/apidoc/v2/products_bulk_actions/verify_checksum_products.en.html
    any.satellite.com/apidoc/v2/repositories/verify_checksum.en.html
Functional demonstration
  1. New ones:
sat.api.Capsule(id='2').content_verify_checksum()
Out[5]: 
{'id': 'bb8d5992-525f-4c94-8195-8aab9437808f',
 'label': 'Actions::Katello::CapsuleContent::VerifyChecksum',
 'pending': False,
 'action': 'Verify checksum for content on capsule',
 'username': 'admin',
 'started_at': '2024-04-19 16:05:06 UTC',
 'ended_at': '2024-04-19 16:05:07 UTC',
 'duration': '0.707085',
 'state': 'stopped',
 'result': 'success',
 'progress': 1.0,
 'input': {'options': {'environment_id': None,
   'content_view_id': None,
   'repository_id': None,
   'environment_ids': [1]},
  'smart_proxy': {'id': 2,
   'name': 'capsule.redhat.com'},
  'services_checked': ['pulp3'],
  'current_request_id': '446b226c-78c7-4a91-ad00-5aac95630654',
  'current_timezone': 'UTC',
  'current_organization_id': None,
  'current_location_id': None,
  'current_user_id': 4},
 'output': {},
 'humanized': {'action': 'Verify checksum for content on capsule',
  'input': [],
  'output': '',
  'errors': []},
 'cli_example': None,
 'start_at': '2024-04-19 16:05:06 UTC',
 'available_actions': {'cancellable': False, 'resumable': False}}
sat.api.ContentViewVersion(id='2').verify_checksum()
Out[7]: 
{'id': '8eb06358-196d-43c2-b6bf-d09c6df8a9df',
 'label': 'Actions::Katello::ContentViewVersion::VerifyChecksum',
 'pending': False,
 'action': "Verify checksum of repositories in CV-1 1.0 content view 'CV-1'; organization 'Default Organization'",
 'username': 'admin',
 'started_at': '2024-04-19 15:28:21 UTC',
 'ended_at': '2024-04-19 15:28:36 UTC',
 'duration': '15.470075',
 'state': 'stopped',
 'result': 'success',
 'progress': 1.0,
 'input': {'content_view': {'id': 2, 'name': 'CV-1', 'label': 'CV-1'},
  'organization': {'id': 1,
   'name': 'Default Organization',
   'label': 'Default_Organization'},
  'version_id': 2,
  'current_request_id': '744e3397-bf4c-4f09-bbc7-7777dde34aae',
  'current_timezone': 'UTC',
  'current_organization_id': None,
  'current_location_id': None,
  'current_user_id': 4},
 'output': {},
 'humanized': {'action': 'Verify checksum of repositories in CV-1 1.0',
  'input': [['content_view',
    {'text': "content view 'CV-1'", 'link': '/content_views/2/versions'}],
   ['organization',
    {'text': "organization 'Default Organization'",
     'link': '/organizations/1/edit'}]],
  'output': '',
  'errors': []},
 'cli_example': None,
 'start_at': '2024-04-19 15:28:21 UTC',
 'available_actions': {'cancellable': False, 'resumable': False}}
  1. Existing ones:
sat.api.ProductBulkAction().verify_checksum(data={'ids': ['1']})
Out[7]: 
{'id': '7cb6c3f3-4a18-4778-b74c-8d17d309fbdc',
 'label': 'Actions::BulkAction',
 'pending': False,
 'action': "Verify checksum verify checksum; repository 'Modular'; product 'Test_Prod'; organization 'Default Organization'; ...",
 'username': 'admin',
 'started_at': '2024-04-22 08:38:26 UTC',
 'ended_at': '2024-04-22 08:38:42 UTC',
 'duration': '15.686487',
 'state': 'stopped',
 'result': 'success',
 'progress': 1.0,
 'input': {'action_class': 'Actions::Katello::Repository::VerifyChecksum',
  'target_ids': [1, 5, 4],
  'target_class': 'Katello::Repository',
  'args': [],
  'kwargs': {},
  'current_request_id': '67ea6c01-8701-4199-91bb-878f148f7d36',
  'current_timezone': 'UTC',
  'current_organization_id': None,
  'current_location_id': None,
  'current_user_id': 4,
  'dynflow': {}},
 'output': {'planned_count': 3,
  'cancelled_count': 0,
  'total_count': 3,
  'failed_count': 0,
  'pending_count': 0,
  'success_count': 3},
 'humanized': {'action': 'Verify checksum',
  'input': ['verify checksum',
   ['repository', {'text': "repository 'Modular'", 'link': None}],
   ['product', {'text': "product 'Test_Prod'", 'link': '/products/1/'}],
   ['organization',
    {'text': "organization 'Default Organization'",
     'link': '/organizations/1/edit'}],
   '...'],
  'output': '3 task(s), 3 success, 0 fail',
  'errors': []},
 'cli_example': None,
 'start_at': '2024-04-22 08:38:26 UTC',
 'available_actions': {'cancellable': False, 'resumable': False}}
sat.api.Repository(id='4').verify_checksum()
Out[8]: 
{'id': 'b425b302-d93a-4ce1-a506-8754aef88667',
 'label': 'Actions::Katello::Repository::VerifyChecksum',
 'pending': False,
 'action': "Verify checksum repository 'Yum3'; product 'Test_Prod'; organization 'Default Organization'",
 'username': 'admin',
 'started_at': '2024-04-22 08:45:55 UTC',
 'ended_at': '2024-04-22 08:45:56 UTC',
 'duration': '0.9251',
 'state': 'stopped',
 'result': 'success',
 'progress': 1.0,
 'input': {'repository': {'id': 4, 'name': 'Yum3', 'label': 'Yum3'},
  'product': {'id': 1,
   'name': 'Test_Prod',
   'label': 'Test_Prod',
   'cp_id': '169172977238'},
  'provider': {'id': 1, 'name': 'Anonymous'},
  'organization': {'id': 1,
   'name': 'Default Organization',
   'label': 'Default_Organization'},
  'services_checked': ['pulp3'],
  'current_request_id': 'd5ef80d8-361a-4a13-9eb1-43a2b1e7de27',
  'current_timezone': 'UTC',
  'current_organization_id': None,
  'current_location_id': None,
  'current_user_id': 4},
 'output': {},
 'humanized': {'action': 'Verify checksum',
  'input': [['repository', {'text': "repository 'Yum3'", 'link': None}],
   ['product', {'text': "product 'Test_Prod'", 'link': '/products/1/'}],
   ['organization',
    {'text': "organization 'Default Organization'",
     'link': '/organizations/1/edit'}]],
  'output': 'Waiting to start.\n--------------------------------\nIdentify corrupted units: 0/0\nIdentify missing units: 0/0\nRepair corrupted units: 0/0',
  'errors': []},
 'cli_example': None,
 'start_at': '2024-04-22 08:45:55 UTC',
 'available_actions': {'cancellable': False, 'resumable': False}}
Additional Information

The new endpoints are not present in snap 54 yet, packit is needed for testing.

@vsedmik vsedmik added the No-CherryPick PR doesnt need CherryPick to previous branches label Apr 19, 2024
@vsedmik vsedmik self-assigned this Apr 19, 2024
Copy link
Contributor

@sambible sambible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you might be missing the product and capsule endpoints in the test_entities test? I might be misreading this, though.

@vsedmik
Copy link
Contributor Author

vsedmik commented May 7, 2024

It looks like you might be missing the product and capsule endpoints in the test_entities test? I might be misreading this, though.

Capsule is added here and Product here to the methods_requests, so I thought they should be exercised in the test_generic.

Copy link
Contributor

@vijaysawant vijaysawant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check doc string?

Comment on lines +1028 to +1030
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my understanding about synchronous execution,
if synchronous=True then don't wait for current task to execute completely and go for next step
if synchronous=False then wait till current execution to finish completely.

Please correct me if I am wrong.

Suggested change
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Immediately return the server's response
if synchronous is ``True``. Wait for the task to complete otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO it's exaclty the opposite - synchronous means we wait until the task is finished.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see every nailgun entities define doc string in same way.

@vsedmik vsedmik force-pushed the add-verify-checksum-endpoints branch from 0231f6d to 0da546e Compare May 21, 2024 07:58
@vsedmik
Copy link
Contributor Author

vsedmik commented May 21, 2024

rebased

@ogajduse ogajduse merged commit 1774a48 into SatelliteQE:master May 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No-CherryPick PR doesnt need CherryPick to previous branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants