-
Notifications
You must be signed in to change notification settings - Fork 82
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
refactor(RHINENG-12780): Enhance delete events #2111
base: master
Are you sure you want to change the base?
refactor(RHINENG-12780): Enhance delete events #2111
Conversation
api/host.py
Outdated
@@ -243,6 +243,7 @@ def delete_hosts_by_filter( | |||
|
|||
|
|||
def _delete_host_list(host_id_list, rbac_filter): | |||
request_host = flask.request.headers.get("Host", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the request_host value, if I make a REST API call from my laptop?
Also suggest using requesting_host
to leave out any ambiguity.
api/host.py
Outdated
@@ -312,6 +314,10 @@ def delete_host_by_id(host_id_list, rbac_filter=None): | |||
return flask.Response(None, HTTPStatus.OK) | |||
|
|||
|
|||
def check_manual_deletion(origin_host: str = ""): | |||
return origin_host in ["console.stage.redhat.com", "console.redhat.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest using origin_host.lower()
, just in case CONSOLE.*
or Console.*
is used by the the request.
app/queue/events.py
Outdated
@@ -76,6 +76,8 @@ class HostDeleteEvent(Schema): | |||
org_id = fields.Str() | |||
insights_id = fields.Str() | |||
request_id = fields.Str() | |||
subscription_manager_id = fields.Str() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should start using fields.UUID()
for all fields with value type UUID.
api/host.py
Outdated
@@ -243,6 +243,7 @@ def delete_hosts_by_filter( | |||
|
|||
|
|||
def _delete_host_list(host_id_list, rbac_filter): | |||
request_host = flask.request.headers.get("Host", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be renamed to another thing? My understand is that this value would be the consoleDOT URL?
request_host = flask.request.headers.get("Host", "") | |
request_host_url = flask.request.headers.get("Host", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpramos123 I think it's just the hostname of the request, so maybe request_hostname
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kruai Yup, makes sense
00f4220
to
279ee52
Compare
279ee52
to
0d4b216
Compare
api/host.py
Outdated
@@ -312,6 +314,10 @@ def delete_host_by_id(host_id_list, rbac_filter=None): | |||
return flask.Response(None, HTTPStatus.OK) | |||
|
|||
|
|||
def check_manual_deletion(origin_host: str = ""): | |||
return origin_host in ["console.stage.redhat.com", "console.redhat.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check enough to tell that the request is specifically from the UI? It looks to me like this header gets set to the target hostname for all HTTP requests
tests/helpers/mq_utils.py
Outdated
@@ -129,6 +137,11 @@ def assert_delete_event_is_valid( | |||
|
|||
assert host.canonical_facts.get("insights_id") == event["insights_id"] | |||
|
|||
assert event["manual_delete"] == is_manual_delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert event["manual_delete"] == is_manual_delete | |
assert event["manual_delete"] is is_manual_delete |
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com> Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com> Co-authored-by: Asa Price <[email protected]>
…sights#2126) Bumps [pytest-subtests](https://github.com/pytest-dev/pytest-subtests) from 0.13.1 to 0.14.1. - [Release notes](https://github.com/pytest-dev/pytest-subtests/releases) - [Changelog](https://github.com/pytest-dev/pytest-subtests/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest-subtests@v0.13.1...v0.14.1) --- updated-dependencies: - dependency-name: pytest-subtests dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [boto3](https://github.com/boto/boto3) from 1.35.77 to 1.35.78. - [Release notes](https://github.com/boto/boto3/releases) - [Commits](boto/boto3@1.35.77...1.35.78) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Asa Price <[email protected]>
Bumps [boto3](https://github.com/boto/boto3) from 1.35.78 to 1.35.79. - [Release notes](https://github.com/boto/boto3/releases) - [Commits](boto/boto3@1.35.78...1.35.79) --- updated-dependencies: - dependency-name: boto3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.8.2 to 0.8.3. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](astral-sh/ruff@0.8.2...0.8.3) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…dHatInsights#2097) * add env var to log system profile fields * feat: implement logs to host methods * test: implement tests * feat: add system profile to expection logs * feat: propagate log message * add instructions to README.md
….3 (RedHatInsights#2129) Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com> Co-authored-by: red-hat-konflux[bot] <126015336+red-hat-konflux[bot]@users.noreply.github.com> Co-authored-by: Asa Price <[email protected]>
36bb001
to
67278c6
Compare
Overview
This PR is being created to address RHINENG-12780.
Adds
subscription_manager_id
to delete events. The correct logic formanual_delete
is going to be added in a following PRPR Checklist
Secure Coding Practices Documentation Reference
You can find documentation on this checklist here.
Secure Coding Checklist