Skip to content

Commit

Permalink
lint & doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Jan 20, 2024
1 parent 02250a9 commit c218a1c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ There are multiple Ansible WebUI products - how do they compare to this product?

* **This project**

It is built to be very lightweight.
It is built to be lightweight.

As Ansible already requires Python3 - I chose it as primary language.

Expand Down
6 changes: 5 additions & 1 deletion docs/source/usage/2_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ Environmental variables

* **AW_RUN_TIMEOUT**

Timeout for the execution of a playbook in seconds. Default: 3600 (1h)
Timeout for the execution of a playbook in seconds. Default: 3.600 (1h)

You might want to lower this value to a sane value for your use-cases.

* **AW_SESSION_TIMEOUT**

Timeout for WebUI sessions in seconds. Default: 43.200 (12h)
10 changes: 10 additions & 0 deletions src/ansible-webui/aw/api_endpoints/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import serializers
from rest_framework.permissions import IsAuthenticated
from rest_framework_api_key.permissions import BaseHasAPIKey

Expand All @@ -27,3 +28,12 @@ def get_api_user(request) -> settings.AUTH_USER_MODEL:
pass

return request.user


class BaseResponse(serializers.Serializer):

def create(self, validated_data):
pass

def update(self, instance, validated_data):
pass
8 changes: 4 additions & 4 deletions src/ansible-webui/aw/api_endpoints/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
from aw.utils.util import datetime_w_tz
from aw.config.hardcoded import KEY_TIME_FORMAT
from aw.model.api import AwAPIKey
from aw.api_endpoints.base import API_PERMISSION, get_api_user
from aw.api_endpoints.base import API_PERMISSION, get_api_user, BaseResponse


# todo: allow user to add comment to easier identify token
class KeyReadResponse(serializers.Serializer):
class KeyReadResponse(BaseResponse):
tokens = serializers.ListSerializer(child=serializers.CharField())


class KeyWriteResponse(serializers.Serializer):
class KeyWriteResponse(BaseResponse):
token = serializers.CharField()
secret = serializers.CharField()

Expand Down Expand Up @@ -50,7 +50,7 @@ def post(self, request):
return Response({'token': token, 'key': key})


class KeyDeleteResponse(serializers.Serializer):
class KeyDeleteResponse(BaseResponse):
msg = serializers.CharField()


Expand Down

0 comments on commit c218a1c

Please sign in to comment.