-
Notifications
You must be signed in to change notification settings - Fork 34
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
Finish integrations #218
Merged
Merged
Finish integrations #218
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
8d8788d
chore: Improve integrations handling
snaselj 1b3050a
fix: Add changelog.
snaselj adea05c
fix: Circular import
snaselj 62e1b68
fix: Replace obsolete WEBEX_TEAMS... with WEBEX...
snaselj 0bbbeae
fix: Unittest not to be dependent on creds.example
snaselj e740506
fix: black
snaselj dba7323
fix: Extra coma
snaselj 225028e
doc: Admin install ACI
snaselj 8ef287d
docs: Added /aci user commands, improvements
snaselj 2aa6be7
docs: ACI screenshots
snaselj beda413
chore: Webex cleanup
snaselj 9a9a4df
chore: Add missing empty docs
snaselj 1616ac7
chore: Credits to original contributors
snaselj b071c02
fix: Better format nautobot subcommands help
snaselj db845d1
fix: pylint line length
snaselj 38a4631
Merge remote-tracking branch 'origin/develop' into u/snaselj-finish-i…
snaselj 0708160
Merge remote-tracking branch 'origin/develop' into u/snaselj-finish-i…
snaselj 65b06e9
fix: PR comments
snaselj 394ca88
fix: Include glossary to users guide
snaselj 7f7cf9e
chore: Rename arista_cloudvision to arista_cv
snaselj e370561
chore: Commands, some of install instructions
snaselj e05bb8e
doc: Grafana and fixes
snaselj 657689a
doc: IPFabric
snaselj bb9905e
doc: Meraki
snaselj 18b2ccb
doc: Panorama
snaselj f545665
doc: Dev and fixes
snaselj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- Added `/clear` command to development Mattermost. | ||
- Improved integration workers loading. | ||
- Sorted App config and environment variables. | ||
- Sorted pyproject configurations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,48 @@ | ||
# nautobot_chatops | ||
SLACK_API_TOKEN=xoxb-... | ||
SLACK_SIGNING_SECRET=... | ||
# SLACK_SLASH_COMMAND_PREFIX=/ | ||
MICROSOFT_APP_ID=... | ||
MICROSOFT_APP_PASSWORD=... | ||
WEBEX_TEAMS_ACCESS_TOKEN=... | ||
WEBEX_TEAMS_SIGNING_SECRET=... | ||
MATTERMOST_API_TOKEN="5qsffxoapt883qfdygbdgf17jy" | ||
POSTGRES_PASSWORD=notverysecurepwd | ||
REDIS_PASSWORD=notverysecurepwd | ||
SECRET_KEY=r8OwDznj!!dci#P9ghmRfdu1Ysxm0AiPeDCQhKE+N_rClfWNj | ||
NAUTOBOT_CREATE_SUPERUSER=true | ||
NAUTOBOT_SUPERUSER_API_TOKEN=0123456789abcdef0123456789abcdef01234567 | ||
NAUTOBOT_SUPERUSER_PASSWORD=admin | ||
NAUTOBOT_TOWER_PASSWORD="password" | ||
|
||
# Cisco ACI Chatops Plugin Settings | ||
# = Chat Platforms =================== | ||
|
||
# - Mattermost ----------------------- | ||
MATTERMOST_API_TOKEN="5qsffxoapt883qfdygbdgf17jy" | ||
|
||
# - Microsoft Teams ------------------ | ||
# MICROSOFT_APP_ID="changeme" | ||
# MICROSOFT_APP_PASSWORD="changeme" | ||
|
||
# - Slack ---------------------------- | ||
# SLACK_API_TOKEN="xoxb-changeme" | ||
# SLACK_APP_TOKEN="changeme" | ||
# SLACK_SIGNING_SECRET="changeme" | ||
|
||
# - Webex ---------------------------- | ||
# WEBEX_ACCESS_TOKEN="changeme" | ||
# WEBEX_SIGNING_SECRET="changeme" | ||
|
||
# = ChatOps Integrations ============= | ||
|
||
# - Cisco ACI ------------------------ | ||
# First APIC | ||
APIC_USERNAME_NTCAPIC=admin | ||
APIC_PASSWORD_NTCAPIC=notverysecurepwd | ||
APIC_URI_NTCAPIC=https://aci.demo.networktocode.com | ||
APIC_VERIFY_NTCAPIC=false | ||
# APIC_USERNAME_NTCAPIC=admin | ||
# APIC_PASSWORD_NTCAPIC=notverysecurepwd | ||
# APIC_URI_NTCAPIC=https://aci.demo.networktocode.com | ||
# APIC_VERIFY_NTCAPIC=false | ||
# Second APIC | ||
APIC_USERNAME_LAB=admin | ||
APIC_PASSWORD_LAB=labpassword | ||
APIC_URI_LAB=https://10.100.1.10 | ||
APIC_VERIFY_LAB=false | ||
# APIC_USERNAME_LAB=admin | ||
# APIC_PASSWORD_LAB=labpassword | ||
# APIC_URI_LAB=https://10.100.1.10 | ||
# APIC_VERIFY_LAB=false | ||
# Repeat for as many as you need... | ||
|
||
MERAKI_API_KEY=1234567890 | ||
# - Ansible -------------------------- | ||
NAUTOBOT_TOWER_PASSWORD="password" | ||
|
||
# - Meraki --------------------------- | ||
# MERAKI_API_KEY="1234567890" | ||
|
||
PANORAMA_HOST=localhost | ||
PANORAMA_USER=admin | ||
PANORAMA_PASSWORD=admin | ||
# - Panorama ------------------------- | ||
# PANORAMA_PASSWORD=admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
"""Utility functions for nautobot_chatops integrations.""" | ||
from collections.abc import Mapping | ||
from importlib import import_module | ||
from pathlib import Path | ||
from types import ModuleType | ||
from typing import Generator | ||
|
||
from django.conf import settings | ||
|
||
from nautobot_chatops.utils import logger | ||
|
||
|
||
def _each_integration() -> Generator[str, None, None]: | ||
"""Return all integrations.""" | ||
for path in Path(__file__).parent.iterdir(): | ||
if (path / "worker.py").is_file(): | ||
yield path.name | ||
|
||
|
||
ALL_INTEGRATIONS = set(_each_integration()) | ||
|
||
|
||
def _each_enabled_integration() -> Generator[str, None, None]: | ||
"""Return all enabled integrations.""" | ||
if not isinstance(settings.PLUGINS_CONFIG, Mapping): | ||
raise TypeError("Django `settings.PLUGINS_CONFIG` must be a Mapping") | ||
|
||
config = settings.PLUGINS_CONFIG["nautobot_chatops"] | ||
if not isinstance(config, Mapping): | ||
raise TypeError("nautobot_chatops config must be a Mapping") | ||
|
||
for name in ALL_INTEGRATIONS: | ||
if config.get(f"enable_{name}", False): | ||
yield name | ||
|
||
|
||
ENABLED_INTEGRATIONS = set(_each_enabled_integration()) | ||
DISABLED_INTEGRATIONS = ALL_INTEGRATIONS - ENABLED_INTEGRATIONS | ||
|
||
|
||
def each_enabled_integration_module(module_name: str) -> Generator[ModuleType, None, None]: | ||
"""For each enabled integration, import the module name.""" | ||
for name in ENABLED_INTEGRATIONS: | ||
try: | ||
module = import_module(f"nautobot_chatops.integrations.{name}.{module_name}") | ||
except ModuleNotFoundError: | ||
logger.debug("Integration %s does not have a %s module, skipping.", name, module_name) | ||
continue | ||
|
||
yield module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We went with Webex Teams when it was rebranded. Did Webex Teams become Webex again?
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.
In addition, I know it doesn't really matter, as Admins can change the nautobot_config.py to whatever they want, it will still cause issues when using an older creds.env for developers expecting WEBEX_TEAMS_ACCESS_TOKEN.
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.
Expecting the next ChatOps App version to be 2.0, I was taking into account this deprecation: https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/admin/install/webex_setup.md#deprecation-warning
Webex Teams
brand doesn't seem to be advertised by Ciso, when using search tools.The old
WEBEX_TEAMS_ACCESS_TOKEN
is directly consumed bywebexteamssdk
library, howeverWEBEX_ACCESS_TOKEN
is read by the Appnautobot_config.py
, passed to App config, and then passed to the library as arguments. Seems to me a bit better to use environment variables controlled by our App config to allow us some validations.I would stay with
Webex
and emphasize this change in the documentation I'm preparing WDYT?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.
I can replace all
WebEx
occurrences withWebex
including class names in the code, to be inline with the official Cisco naming, WDYT @smk4664 ?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.
I thought this was going out pre 2.0, but we are close to the Nautobot 2.0 release, so I am good with these changes.
As long as we document them.
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.
Webex cleaned up:
WebEx
=>Webex
.def get_app_config_part(prefix)
.webex_teams
related deprecation warnings and usage.webex_msg_char_limit
App config entry.