Skip to content

Commit

Permalink
Release v20200518 (#333)
Browse files Browse the repository at this point in the history
* Basic Authentication  (#217)

Initial work on Basic Authentication.

* Task/active tasks (#240)

* Adjusting tabs so they render correctly.

* Only create tasks notifications for active incidents.

* Allows incidents to be filtered by tag. (#238)

* Allows incidents to be filtered by tag.

* Adds 'load more' item to find tags not returned in the first 5 results

* Feature/incident auto tagger (#233)

* Initial work on auto tagging incidents

* Initial work on decoupling plugins from creation flow (#223)

* Initial work on decoupling plugins from creation flow

* Small plugin fixes with alembic. (#242)

* Updates auth and incident cost docs (#245)

* Let's use Join Incident in all Slack buttons (#246)

* Moving models around such that they are available for use. (#249)

* Allows user auth to be disabled returning a default user. (#250)

* Making some minor fixes around basic auth (#241)

* Making some minor fixes around basic auth

Co-authored-by: Marc Vilanova <[email protected]>

* Minor edit (#251)

* Moving basic auth to an auth plugin (#252)

* Fixes incident types and priorities paths in the Web UI router config (#256)

* Fixes incident types and priorities paths in the Web UI

* Adds note

* Importing main instead of api directly (#258)

* Upgraded node version to 12.16.2 (#260)

Signed-off-by: Daniel Sutton <[email protected]>

* Adds all plugin event API routes to the API router before adding them to the Web API framework (#261)

* Adds flags to plugins allowing them to specify if they are required (#259)

* Adds flags to plugins allowing them to specify if they can have more than one or are required for dispatch to work.

* Adds more timeline events (#262)

* Cleaning up old un-used commands (#263)

* Reads variables from .env file as well as envvars (#264)

* Refactors nlp logic in the route service to use the centralized nlp module (#265)

* Fixing an issue with database being in a bad state (#268) (#269)

* Fixes bug in the incident cost model (#274)

* Fixing an issue with database being in a bad state (#268)

* Fixes bug in the incident cost model (#273)

Co-authored-by: kevgliss <[email protected]>

* fix typo in setup.py (#275)

* Fixed empty enabled column in table 'plugin' (#270)

* Fixed empty enabled column in table 'plugin'

* no getattr

* Bugfix router login redirect (#277)

* Fixed empty enabled column in table 'plugin'

* no getattr

* the user should continue on

* Fixes metric query, and reduces bundle size by allowing for treeshaki… (#276)

* Fixes metric query, and reduces bundle size by allowing for treeshaking of lodash.

Co-authored-by: Marc Vilanova <[email protected]>

* Fixes plugins version (#278)

* Let's allow users to disable a plugin (#280)

* Correctly check the current revision (#281)

* Timeline event details (#282)

* Updates typescript

* Adds JSON-based, details column to the event data model

* Adds switch

* Using v-card so we can show all details

* Addresses comments

* Removes unused import

* Allowing resources to be optionally created (#279)

* Refactors incident table filter (#284)

* Adding default icon (#285)

* Initial work adding RBAC controls (#266)

* Adding basic RBAC controls

* Removing loading overlay (#286)

* Fetching current user info from server (#287)

* Fixing the generation of swagger documentation (#289)

* Disabling after hours until we figure out a caching fix. (#290)

* Fixes help links for multi-messages and adds task resolution directions. (#288)

* Fixes help links for multi-messages and adds task resolution directions.

Co-authored-by: Marc Vilanova <[email protected]>

* Removing dead code (#292)

* Moving notification caching to the database. (#291)

* Moving notification caching to the database

* removing un-needed code

* We return a user object from current_user instead of an email string (#293)

* Improves Dockerfile (#296)

* Adding Conference tests. (#267)

* `yield_fixture` is deprecated after pytest 3.0.

Plain old `fixture` is fine.

* [WIP] Adding Conference model and service tests.

* Use four spaces per indent in Python files.

* Add assertions and stub functions.

* Fix naming convention for conference tests.
* Remove 'name', as it's not present in the Conference model.

* Return a List of Conferences.

When asking for all the Conferences of a given resource type, it doesn't
make sense to ask for only one, or None (and throw an exception). It
seems more sensible to request the whole list, or even a paginated list.
Since this method isn't used anywhere in the code yet, we'll
just return all().

* Black formatting.

* Ensure our stub functions have args.

* Test retrieval of a List of Conferences.

* Add a test fixture to create multiple conferences.

* Class Meta above instance vars

* Incorporating suggested change

* Lowercase as suggested

* Implements test_conference_get_by_conference_id

* get_by_incident_id fails

* Implements test_conference_get_all

* Ensure we're testing the created Conference.

* Move ConferenceFactory later.

This way an IncidentFactory has been defined and is available.

* Give mocked Incident objects a fake ID.

* This test works fine now.

* Adds Join Incident button to stable incidents in daily summary (#298)

* Prevents user being redirected to /login on 401 requests for pkce flow (#300)

* Prevents user being redirected to /login on 401 requests for pkce flow

* Modifying incident get permissions

* changing from prophet to statsmodels (#297)

Co-authored-by: Shannon Morrison <[email protected]>

* Fixes the dialog behavior of columns (#304)

* Fixes the dialog behavior of columns

* Removing un-related files

* Reporting incidents via Slack slash command (#294)

* #180 : initial commit - initiating incident from slack via slack commands

* Update src/dispatch/plugins/dispatch_slack/views.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/views.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/config.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/messaging.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/messaging.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/plugin.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/views.py

Co-authored-by: Marc Vilanova <[email protected]>

* Update src/dispatch/plugins/dispatch_slack/messaging.py

Co-authored-by: Marc Vilanova <[email protected]>

* updates based on comments provided

* add report-incident to conversation enums.py

* fix issues after starting the application dispatch

* Delete launch.json

* Delete settings.json

* Revert "Delete launch.json"

This reverts commit 55e2c40

Co-authored-by: Vagharsh Kandilian <[email protected]>
Co-authored-by: Marc Vilanova <[email protected]>

* Adds expressions to hybrid properties (#124)

* Adds expressions to hybrid properties

* Removing commend

* Fixes bugs in report incident Slack command (#305)

* Making flake8 happy (#307)

* Making flake8 happy

* More fixes

* MOAR fixes

* Making statsmodels a required package (#308)

* Making statsmodels a required package

* Minor fixes

* modifying launch (#309)

* Failing gracefully if there is insufficent data. (#310)

* Adjusting default landing page to admin UI dashboard. (#313)

* Fixes bug and typo in status notifications (#314)

* Fixes table loading state when API call fails (#315)

* Adds hostname and database name to confirmation (#316)

* Removing exception used for testing (#317)

* Closes the report incident modal after it's submitted (#318)

* Fixes an issue where the report incident modal is not closing after submitting

* Using private metadata field to store channel id

* Bugfix/search ui (#321)

* Initial search work

* Adding clickable items

* Adds as join incident button to the incident status page (#322)

* Adds as join incident button to the incident status page

* Using incident flow

* Fixes search/filter pagination reset (#323)

* Standarizes save/close button icons (#324)

* Using checkbox for table booleans (#325)

* Ensures all table actions are under row ellipsis menu (#326)

* fixing linting issue (#329)

* Add custom profile field mapping for slack to get Team, Department, W… (#327)

* Add custom profile field mapping for slack to get Team, Department, Weblink

* Update config names to address PR feedback

* Update docs with new config vars

* Revert "Update docs with new config vars"

This reverts commit 7889530.

* update docs and revert unwanted files

* remove unused import

* Adding a unique constraint on the dispatch user email (#331)

* Add author and author URL to zoom plugin to fix plugins page (#330)

Co-authored-by: Stefan Mihartescu <[email protected]>
Co-authored-by: Marc Vilanova <[email protected]>
Co-authored-by: Daniel Sutton <[email protected]>
Co-authored-by: batman <[email protected]>
Co-authored-by: Forest Monsen <[email protected]>
Co-authored-by: Shannon <[email protected]>
Co-authored-by: Shannon Morrison <[email protected]>
Co-authored-by: Vagharsh Kandilian <[email protected]>
Co-authored-by: Vagharsh Kandilian <[email protected]>
Co-authored-by: Will Bengtson <[email protected]>
  • Loading branch information
11 people authored May 18, 2020
1 parent 950ff2d commit ae2209a
Show file tree
Hide file tree
Showing 188 changed files with 4,616 additions and 2,091 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ indent_style=space
indent_size=2
trim_trailing_whitespace=true

[*.py]
indent_size=4

[{*.ng,*.sht,*.html,*.shtm,*.shtml,*.htm}]
indent_style=space
indent_size=2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ venv/
ENV/
env.bak/
venv.bak/
.vscode/

# Spyder project settings
.spyderproject
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.7.0
12.16.2
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"name": "Server Debug",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/dispatch/run.py"
"program": "${workspaceFolder}/bin/run.py"
},
{
"type": "chrome",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"editor.codeActionsOnSave": {
"source.organizeImports": false
}
}
},
}
File renamed without changes.
19 changes: 11 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ LABEL org.opencontainers.image.authors="[email protected]"
RUN apt-get update && apt-get install -y --no-install-recommends \
# Needed for GPG
dirmngr \
gnupg \
gnupg2 \
# Needed for fetching stuff
ca-certificates \
wget \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -35,16 +36,18 @@ RUN for key in \
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
; do \
gpg --batch --keyserver hkps://mattrobenolt-keyserver.global.ssl.fastly.net:443 --recv-keys "$key"; \
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key"; \
done

# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.11
ENV GOSU_VERSION 1.12
RUN set -x \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -r /usr/local/bin/gosu.asc \
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu

# grab tini for signal processing and zombie killing
Expand All @@ -53,7 +56,7 @@ RUN set -x \
&& wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" \
&& wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \
&& gpg --batch --verify /usr/local/bin/tini.asc /usr/local/bin/tini \
&& rm /usr/local/bin/tini.asc \
&& rm -f /usr/local/bin/tini.asc \
&& chmod +x /usr/local/bin/tini

# Get and set up Node for front-end asset building
Expand All @@ -65,7 +68,7 @@ RUN cd /usr/src/dispatch \
&& gpg --batch --verify SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
&& rm -r "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc
&& rm -f "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc

ARG SOURCE_COMMIT
ENV DISPATCH_BUILD=${SOURCE_COMMIT:-unknown}
Expand Down
34 changes: 27 additions & 7 deletions docs/configuration/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,35 @@ In general, do not include any quotation marks when adding configuration values.
### Authentication

#### `DISPATCH_AUTHENTICATION_PROVIDER` \['default': dispatch-auth-provider-pkce\]
#### `DISPATCH_AUTHENTICATION_PROVIDER_SLUG` \['default': dispatch-auth-provider-basic\]

> Used by Dispatch to determine which authentication provider to use, by default Dispatch ships with a PKCE authentication provider.
{% hint style="info" %}
If you wish to disabled authentication set `DISPATCH_AUTHENTICATION_PROVIDER=""`
If you wish to disable authentication set `DISPATCH_AUTHENTICATION_PROVIDER=""`
{% endhint %}

#### Configuration for `dispatch-auth-provider-basic`

{% hint style="warning" %}
Today, basic authentication allows self registration without approval.
{% endhint %}

#### `DISPATCH_JWT_SECRET`

> Uses by the basic auth provider to mint JWT tokens.
#### `DISPATCH_JWT_ALG` ['default': 'HS256']

> Used by the basic auth provider to mint JWT tokens.
#### `DISPATCH_JWT_EXP` ['default': 86400 ]

> Used by the basic auth provider to mint JWT tokens and set their expiration.
#### `DISPATCH_AUTHENTICATION_DEFAULT_USER` \['default': [email protected]\]

> Used when authentication is disable as the default anonymous user.
> Used as the default anonymous user when authentication is disabled.
#### Configuration for `dispatch-auth-provider-pkce`

Expand All @@ -77,11 +95,11 @@ If you wish to disabled authentication set `DISPATCH_AUTHENTICATION_PROVIDER=""`
#### `VUE_APP_DISPATCH_AUTHENTICATION_PROVIDER_PKCE_OPEN_ID_CONNECT`

> Used by the Dispatch Web UI send the user via Proof Key Code Exchange \(PKCE\) to a correct open id connect endpoint.
> Used by the Dispatch Web UI send the user via Proof Key Code Exchange \(PKCE\) to a correct OpenID Connect endpoint.
#### `VUE_APP_DISPATCH_AUTHENTICATOIN_PROVIDER_PKCE_CLIENT_ID`

> The client id to send to the open id connect endpoint.
> The client id to send to the OpenID Connect endpoint.
### Persistence

Expand All @@ -105,13 +123,15 @@ If you wish to disabled authentication set `DISPATCH_AUTHENTICATION_PROVIDER=""`

### Incident Cost

Dispatch [calculates](https://github.com/Netflix/dispatch/blob/develop/src/dispatch/incident/service.py#L279) the cost of an incident by adding up the time participants have spent on each incident role (e.g. Incident Commander) and applying an [engagement multiplier](https://github.com/Netflix/dispatch/blob/develop/src/dispatch/incident/service.py#L266) that's based on the incident role. It also includes time spent on incident review related activities. Dispatch calculates and published the cost for all incidents [every 5 minutes](https://github.com/Netflix/dispatch/blob/develop/src/dispatch/incident/scheduled.py#L257).

#### `ANNUAL_COST_EMPLOYEE` \[default: '50000'\]

> Used for incident cost modeling, specifies the total `all-in` cost for an average employee working on incidents.
> Used for incident cost modeling, specifies the total `all-in` average cost for an employee working on incidents.
#### `BUSINESS_HOURS_YEAR` \[default: '2080'\]

> Used for incident cost modeling, specifies the number of hours in an employee's work week.
> Used for incident cost modeling, specifies the number of hours in an employee's work year.
### Incident Plugin Configuration

Expand Down
13 changes: 13 additions & 0 deletions docs/configuration/plugins/configuring-slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ The `Slack` plugin relies on the [Events API](https://api.slack.com/events-api)

> List resources command as displayed in Slack.
#### `SLACK_PROFILE_DEPARTMENT_FIELD_ID`

> Specifies the profile field ID where Department is mapped
#### `SLACK_PROFILE_TEAM_FIELD_ID`

> Specifies the profile field ID where Team is mapped
#### `SLACK_PROFILE_WEBLINK_FIELD_ID`

> Specifies the profile field ID where the weblink is mapped
## Event Subscriptions

To enable Dispatch to process Slack events, ensure your bot is subscribed to the following events:
Expand Down Expand Up @@ -128,6 +140,7 @@ remote_files:read
team:read
users:read
users:read.email
users.profile:read
users:write
```

Expand Down
4 changes: 4 additions & 0 deletions docs/contributing/plugins/interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ def open_dialog(self, trigger_id: str, dialog: dict):
"""Opens a dialog with a user."""
return

def open_modal(self, trigger_id: str, modal: dict):
"""Opens a modal with a user."""
return

def archive(self, conversation_id: str):
"""Archives conversation."""
return
Expand Down
5 changes: 2 additions & 3 deletions docs/user-guide/incident-participant.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Each new participant receives a welcome message \(Email + Slack\) providing them

![Incident welcome email](https://lh3.googleusercontent.com/9AhkQ-y5h-sQN0F6KLrBEE_6cGA-XN4Qu1cj4NAGNj1OOfA7p4c4z0G7BYxydz3oOYCVkqTkl_EYAeO4SOsCWkVXme5hUByCnYNDkFPQhQTkNYulc--rOQNQGD856s4uPZPYHEwvlk0)

![Incident welcome slack \(ephemeral\)](https://lh4.googleusercontent.com/EgiaPr7p7X-MsmhU7LCNn9BoM0qgqlj-yFBRsxHYGFY6GWSVmYkqNjDzFB-iTNpZBlaxjpVJ_R8HC5jO9gu12ehtIGfT3-7At7lQms-dppkxiFZTyOA8LUQyubCDqLAU23NYwcoQfrw)
![Incident welcome slack (ephemeral)](https://lh4.googleusercontent.com/EgiaPr7p7X-MsmhU7LCNn9BoM0qgqlj-yFBRsxHYGFY6GWSVmYkqNjDzFB-iTNpZBlaxjpVJ_R8HC5jO9gu12ehtIGfT3-7At7lQms-dppkxiFZTyOA8LUQyubCDqLAU23NYwcoQfrw)

From there use the resources as you normally would to run your investigation, Dispatch will be there managing permissions, providing reminders and helping track the incident as it progresses to resolution.

Expand All @@ -39,6 +39,5 @@ After an incident has been marked stable Dispatch is still there to help creatin
In addition to Dispatch pulling in individuals that will be directly responsible for managing the incident, it provides notifications for general awareness throughout the organization.

{% hint style="info" %}
The incident notification message includes a "Get Involved" button, this allows individuals to add themselves to the incident \(and it's resources\) without involvement from the incident commander.
The incident notification message includes a "Join Incident" button, this allows individuals to add themselves to the incident \(and it's resources\) without involvement from the incident commander.
{% endhint %}

5 changes: 5 additions & 0 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@ SQLAlchemy-Searchable
aiofiles
alembic
arrow
bcrypt
cachetools==3.1.1 # NOTE pinning for google-auth
click
email-validator
emails
fastapi
fastapi_permissions
google-api-python-client
google-auth-oauthlib
httpx
jinja2
jira
joblib
numpy
oauth2client
pandas
psycopg2-binary
pyparsing
pypd # pagerduty plugin
Expand All @@ -30,6 +34,7 @@ slackclient
spacy
sqlalchemy
sqlalchemy-filters
statsmodels
tabulate
tenacity
uvicorn
3 changes: 0 additions & 3 deletions requirements-metrics.txt

This file was deleted.

7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ def get_requirements(env):

install_requires = get_requirements("base")
dev_requires = get_requirements("dev")
metrics_requires = get_requirements("metrics")


class DispatchSDistCommand(SDistCommand):
Expand Down Expand Up @@ -397,16 +396,18 @@ def run(self):
packages=find_packages("src"),
python_requires=">=3.7",
install_requires=install_requires,
extras_require={"dev": dev_requires, "metrics": metrics_requires},
extras_require={"dev": dev_requires},
cmdclass=cmdclass,
zip_save=False,
zip_safe=False,
include_package_data=True,
entry_points={
"console_scripts": ["dispatch = dispatch.cli:entrypoint"],
"dispatch.plugins": [
"dispatch_document_resolver = dispatch.plugins.dispatch_core.plugin:DispatchDocumentResolverPlugin",
"dispatch_participant_resolver = dispatch.plugins.dispatch_core.plugin:DispatchParticipantResolverPlugin",
"dispatch_pkce_auth = dispatch.plugins.dispatch_core.plugin:PKCEAuthProviderPlugin",
"dispatch_ticket = dispatch.plugins.dispatch_core.plugin:DispatchTicketPlugin",
"dispatch_basic_auth = dispatch.plugins.dispatch_core.plugin:BasicAuthProviderPlugin",
"google_calendar_conference = dispatch.plugins.dispatch_google.calendar.plugin:GoogleCalendarConferencePlugin",
"google_docs_document = dispatch.plugins.dispatch_google.docs.plugin:GoogleDocsDocumentPlugin",
"google_drive_storage = dispatch.plugins.dispatch_google.drive.plugin:GoogleDriveStoragePlugin",
Expand Down
27 changes: 27 additions & 0 deletions src/dispatch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@
except Exception:
VERSION = "unknown"

from dispatch.conference.models import Conference # noqa lgtm[py/unused-import]
from dispatch.team.models import TeamContact # noqa lgtm[py/unused-import]
from dispatch.conversation.models import Conversation # noqa lgtm[py/unused-import]
from dispatch.definition.models import Definition # noqa lgtm[py/unused-import]
from dispatch.document.models import Document # noqa lgtm[py/unused-import]
from dispatch.event.models import Event # noqa lgtm[py/unused-import]
from dispatch.group.models import Group # noqa lgtm[py/unused-import]
from dispatch.incident.models import Incident # noqa lgtm[py/unused-import]
from dispatch.incident_priority.models import IncidentPriority # noqa lgtm[py/unused-import]
from dispatch.incident_type.models import IncidentType # noqa lgtm[py/unused-import]
from dispatch.individual.models import IndividualContact # noqa lgtm[py/unused-import]
from dispatch.participant.models import Participant # noqa lgtm[py/unused-import]
from dispatch.participant_role.models import ParticipantRole # noqa lgtm[py/unused-import]
from dispatch.policy.models import Policy # noqa lgtm[py/unused-import]
from dispatch.route.models import (
Recommendation, # noqa lgtm[py/unused-import]
RecommendationAccuracy, # noqa lgtm[py/unused-import]
)
from dispatch.service.models import Service # noqa lgtm[py/unused-import]
from dispatch.status_report.models import StatusReport # noqa lgtm[py/unused-import]
from dispatch.storage.models import Storage # noqa lgtm[py/unused-import]
from dispatch.tag.models import Tag # noqa lgtm[py/unused-import]
from dispatch.task.models import Task # noqa lgtm[py/unused-import]
from dispatch.term.models import Term # noqa lgtm[py/unused-import]
from dispatch.ticket.models import Ticket # noqa lgtm[py/unused-import]
from dispatch.plugin.models import Plugin # noqa lgtm[py/unused-import]


def _get_git_revision(path):
if not os.path.exists(os.path.join(path, ".git")):
Expand Down
3 changes: 1 addition & 2 deletions src/dispatch/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from sqlalchemy import engine_from_config, pool

from dispatch.config import SQLALCHEMY_DATABASE_URI

from dispatch.models import * # noqa; noqa
from dispatch.database import Base

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down
39 changes: 39 additions & 0 deletions src/dispatch/alembic/versions/1221a4d60f03_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Adds discoverable column
Revision ID: 1221a4d60f03
Revises: 14d7a4703d7c
Create Date: 2020-04-17 15:25:36.075381
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.orm import Session
from dispatch.tag.models import Tag

import sqlalchemy_utils


# revision identifiers, used by Alembic.
revision = "1221a4d60f03"
down_revision = "14d7a4703d7c"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("tag", sa.Column("discoverable", sa.Boolean()))

conn = op.get_bind()
session = Session(bind=conn)

for tag in session.query(Tag).all():
tag.discoverable = True
session.commit()
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("tag", "discoverable")
# ### end Alembic commands ###
30 changes: 30 additions & 0 deletions src/dispatch/alembic/versions/2d3e511db6b4_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Adds required or multiple fields to plugin data
Revision ID: 2d3e511db6b4
Revises: 62465f508f69
Create Date: 2020-04-23 15:07:03.996871
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "2d3e511db6b4"
down_revision = "62465f508f69"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("plugin", sa.Column("multiple", sa.Boolean(), nullable=True))
op.add_column("plugin", sa.Column("required", sa.Boolean(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("plugin", "required")
op.drop_column("plugin", "multiple")
# ### end Alembic commands ###
Loading

0 comments on commit ae2209a

Please sign in to comment.