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

get rid of the activity stream middleware #6525

Conversation

ryanpetrello
Copy link
Contributor

@ryanpetrello ryanpetrello commented Apr 1, 2020

it has bugs and is very confusing

@ryanpetrello
Copy link
Contributor Author

After this PR, operations made in the API by a specific user still show that user, and operations by the system (like logging in as an LDAP user, and associating groups) still show system:

image

@ryanpetrello
Copy link
Contributor Author

@AlanCoding #1761 (comment)

user = User.objects.filter(id=user.id)
if user.exists():
user = user[0]
instance.actor = user
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -363,6 +364,18 @@ def model_serializer_mapping():
}


def emit_activity_stream_change(instance):
Copy link
Contributor Author

@ryanpetrello ryanpetrello Apr 1, 2020

Choose a reason for hiding this comment

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

Any time we trigger a signal for Activity Stream create/update/delete/associate, just schedule a post-commit function that notifies the external logger.

Copy link
Contributor Author

@ryanpetrello ryanpetrello Apr 1, 2020

Choose a reason for hiding this comment

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

This has the nice side effect of actually making external logging of the activity stream work outside of HTTP requests (like if you call an awx-manage command).

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@@ -399,6 +412,9 @@ def activity_stream_create(sender, instance, created, **kwargs):
else:
activity_entry.setting = conf_to_dict(instance)
activity_entry.save()
connection.on_commit(
lambda: emit_activity_stream_change(activity_entry)
Copy link
Member

Choose a reason for hiding this comment

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

The only thing that concerns me is that this will now be ran in migrations. If some migration created 1M activity stream entries, these methods would pile up, and that would cause problems. I don't feel like migrations should create any activity stream entries, and I disable them when the issue comes up.

@ryanpetrello ryanpetrello force-pushed the bye-bye-activity-stream-middleware branch from 7125495 to 9fe2211 Compare April 1, 2020 20:02
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build failed (gate pipeline). For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@ryanpetrello
Copy link
Contributor Author

regate

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit b6c272e into ansible:devel Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants