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

Uses settings to control ephemeral state. #120

Merged
merged 11 commits into from Mar 2, 2022

Conversation

jvanderaa
Copy link
Contributor

Fixes #114

Moves to use settings for ephemeral settings across all of the dispatchers for what was previously ephemeral=False.

@smk4664
Copy link
Contributor

smk4664 commented Jan 22, 2022

I will want to test this against the chat platforms. I am concerned about some of the Mattermost commands not working in ephemeral messages.

@jvanderaa
Copy link
Contributor Author

Makes sense @smk4664. Note that I left the ephemeral=True settings that were already there. This was effectively a find and replace of ephemeral=False to being ephemeral=settings.PLUGINS_CONFIG["nautobot_chatops"]["send_all_messages_emphemeral"]. I will also need to run through some tests, but the concept is what I was hoping to review first.

nautobot_chatops/dispatchers/base.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/mattermost.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/slack.py Outdated Show resolved Hide resolved
@jvanderaa
Copy link
Contributor Author

@glennmatthews are you good with the overall design (after I fix the calls design to what you have mentioned)? I think this will cover all of the bots then and I will only need to make the update here and not in each chatops plugin implementation.

@glennmatthews
Copy link
Contributor

I'm OK with the idea of it - just want to have confidence that the specific changes being made are tested :-)

@jvanderaa
Copy link
Contributor Author

Looking at what the code is used heavily in the additional chat framework that this request is for, the Slack send_snippet does not support sending messages ephemerally, or directly to an individual.

https://api.slack.com/methods/files.upload

The method send_large_table() uses send_snippet after building the table.

@jvanderaa
Copy link
Contributor Author

This PR will work for Python3.7 implementation and higher at the moment, which should also work for Python3.6. But we do not have the desired state for this yet.

In order to accomplish the original goals, we may need to look at adding a DM feature.

@jvanderaa
Copy link
Contributor Author

Working to figure out the CI (some pylint disables coming where applicable).

docs/design.md Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/slack.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/slack.py Outdated Show resolved Hide resolved
docs/design.md Outdated Show resolved Hide resolved
docs/design.md Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/adaptive_cards.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/base.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/mattermost.py Outdated Show resolved Hide resolved
nautobot_chatops/dispatchers/slack.py Outdated Show resolved Hide resolved
if ephemeral:
message_list = self.split_messages(text, 40000)
for msg in message_list:
self.send_blocks(self.markdown_block(msg), ephemeral=ephemeral)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want markdown formatting to apply to send_snippet in this case - is it possible to send it as plaintext, or at least wrap it in ```\n...\n``` (similar to WebexDispatcher.send_snippet())?

"compose_files": ["docker-compose.requirements.yml", "docker-compose.base.yml", "docker-compose.dev.yml"],
"compose_files": [
"docker-compose.requirements.yml",
# "docker-compose.celery.yml",
Copy link
Contributor

Choose a reason for hiding this comment

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

If 1.1 is now the default nautobot version, don't we need to include celery by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be. I'm going to do the update to nautobot dev environment in a separate PR. This is a better method to have the Celery components commented out but in the code. It is just easier then to get it up and running.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just an easier method to handle converting over to using 1.1 or later. When Nautobot 1.3 comes out we will make the updates to go to Python3.7 and update to the newer methods.

@jvanderaa jvanderaa merged commit 4b85e0c into nautobot:develop Mar 2, 2022
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.

Do not show command results to all channel members (reduce result visibility)
3 participants