Skip to content

Commit

Permalink
Fix plugin resolution location.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Aug 27, 2023
1 parent bec24f0 commit 5f8678d
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
branchId="${GITHUB_REF/refs\/heads\/release\//}"
buildNumber="${branchId}.${GITHUB_RUN_NUMBER}"
echo $branchId $buildNumber
sed "s/0.0.0/${buildNumber}/g" ./localstack_extension/VERSION -i
sed "s/0.0.0/${buildNumber}/g" ./localstack_extension_authress/VERSION -i
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 6 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ echo '{"token":true}' > ~/.localstack/auth.json
```bash
cd localstack-extensions/authress
python -m pip install --upgrade pip
python3 -m pip install --upgrade localstack==2.2.0
python3 -m pip install --upgrade localstack==2.2.1.dev20230825124402
make install
localstack extensions dev enable .
EXTENSION_DEV_MODE=1 localstack start
ACTIVATE_PRO=1 LOCALSTACK_API_KEY=API_KEY EXTENSION_DEV_MODE=1 DEBUG=1 localstack start
```

### For local debugging
After plugin installation from the pypi, the plugin will be available in:
`~/.cache/localstack/volume/lib/extensions/python_venv/lib/python3.10/site-packages/localstack_extension_authress`
1 change: 0 additions & 1 deletion localstack_extension/__init__.py

This file was deleted.

File renamed without changes.
1 change: 1 addition & 0 deletions localstack_extension_authress/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name = "localstack-extension-authress"
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from localstack.utils.container_utils.container_client import ContainerConfiguration
from localstack.utils.strings import short_uid

from localstack_extension.server import ContainerServer
from localstack_extension_authress.server import ContainerServer

LOG = logging.getLogger(__name__)
LOG.setLevel(level=logging.INFO)


class AuthressExtension(Extension):
Expand All @@ -29,15 +30,16 @@ def on_extension_load(self):
"""

if config.DEBUG:
level = logging.DEBUG
else:
level = logging.INFO
logging.getLogger("authress").setLevel(level=level)
LOG.setLevel(level=logging.DEBUG)

LOG.debug("[Authress] ****************** on_extension_load ******************")

def on_platform_start(self):
"""
Called when LocalStack starts the main runtime.
"""

LOG.debug("[Authress] ****************** on_platform_start ******************")

# volumes = VolumeMappings()
# if localstack_volume := get_default_volume_dir_mount():
Expand Down Expand Up @@ -84,6 +86,9 @@ def on_platform_shutdown(self):
"""
Called when LocalStack is shutting down. Can be used to close any resources (threads, processes, sockets, etc.).
"""

LOG.debug("[Authress] ****************** on_platform_shutdown ******************")

if self.server:
self.server.shutdown()
self.server.client.remove_container(self.server.config.name)
Expand Down Expand Up @@ -113,17 +118,23 @@ def update_request_handlers(self, handlers: aws.CompositeHandler):
Called with the custom request handlers of the LocalStack gateway. Overwrite this to add or update handlers.
:param handlers: custom request handlers of the gateway
"""

LOG.debug("[Authress] ****************** update_request_handlers ******************")
pass

def update_response_handlers(self, handlers: aws.CompositeResponseHandler):
"""
Called with the custom response handlers of the LocalStack gateway. Overwrite this to add or update handlers.
:param handlers: custom response handlers of the gateway
"""

LOG.debug("[Authress] ****************** update_response_handlers ******************")
pass

def on_platform_ready(self):
"""
Called when LocalStack is ready and the Ready marker has been printed.
Called when LocalStack is ready and the Ready marker has been LOG.debuged.
"""

LOG.debug("[Authress] ****************** on_platform_ready ******************")
pass
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from typing import Optional

from localstack.utils.container_utils.container_client import (
Expand All @@ -9,9 +8,6 @@
from localstack.utils.serving import Server
from localstack.utils.sync import poll_condition

LOG = logging.getLogger(__name__)


class ContainerServer(Server):
client: ContainerClient
config: ContainerConfiguration
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ long_description_content_type = text/markdown; charset=UTF-8
zip_safe = False
packages = find:
install_requires =
localstack>=2.2
localstack>=2.2.1.dev20230812232603
authress>=3.0.26

[options.entry_points]
localstack.extensions =
localstack-extension-authress = authress.extension:AuthressExtension
localstack-extension-authress = localstack_extension_authress.extension:AuthressExtension
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import path

this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'localstack_extension', 'VERSION')) as version_file:
with open(path.join(this_directory, 'localstack_extension_authress', 'VERSION')) as version_file:
VERSION = version_file.read().strip()

print("Building version", VERSION)
Expand Down

0 comments on commit 5f8678d

Please sign in to comment.