Squest - A service request portal based on Ansible Tower
Squest is a Web portal that allow to expose Tower based automation as a service.
If you want an idea of what you can do with Squest, click on the image below
Like discussed here https://gitter.im/HewlettPackard/squest?at=63038a0c9994996293ffe438 I am trying to implement a custom approval business logic in a python filter triggered by a global hook on request submission.
After some debug on the python module itself, I tried to use the "accept/reject" api via CURL to reduce the debug complexity, but it still throws an error.
That's the curl command :
curl -vvv -X POST "https://[...]/api/service_catalog/request/233/accept/" -H "accept: application/json" -H "authorization: Bearer [...]"
And the error is :
{"required":"This field is required.","null":"This field may not be null.","invalid":"Invalid data. Expected a dictionary, but got {datatype}."}
Please note that :
Seems like I am missing some parameters, but looking at the swagger those apis don't need any payload, just request id in query string.
When I try to request the delete operation fon an instance I got a stack trace from django (I'm on version 1.7.6b).
That's the curl I try to execute :
curl -X POST "https://[...]/api/service_catalog/instance/[...]/operation/[...]/request/" -d '{ "fill_in_survey": { } }' -H 'Content-Type: application/json' -H "accept: application/json" -H "authorization: Bearer [...]"
And that's the django stack trace :
[...]
File "/app/service_catalog/models/request.py", line 62, in full_survey
return {k: v for k, v in {**self.fill_in_survey, **self.admin_fill_in_survey}.items() if v is not None}
Exception Type: TypeError at /api/service_catalog/instance/[...]/operation/[...]/request/
Exception Value: 'str' object is not a mapping
Request information:
USER: admin
GET: No GET data
POST: No POST data
FILES: No FILES data
COOKIES: No cookie data
[...]
Please note that deleting from UI works as expected.
Describe the bug mariadbd error for a docker deployment
1- I did clone the Squest github branch v1.7.5
2 - i did execute the command line : docker-compose up -d
3 - for see if it works : docker ps
[[email protected] squest]#
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14cdc66c3ba7 nginx:alpine "/docker-entrypoint.…" 23 hours ago Up 23 hours 80/tcp, 0.0.0.0:8080->8080/tcp squest_nginx_1
ff61fdf676cf rabbitmq:3-management "docker-entrypoint.s…" 24 hours ago Up 23 hours 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp squest_rabbitmq_1
9e252ca59667 redis:6-alpine "docker-entrypoint.s…" 24 hours ago Up 23 hours 0.0.0.0:6379->6379/tcp squest_redis-cache_1
1aa13d258d4a phpmyadmin/phpmyadmin:5.1.3 "/docker-entrypoint.…" 24 hours ago Up 23 hours 0.0.0.0:8082->80/tcp squest_phpmyadmin_1
57344043bfbd nginx:alpine "/docker-entrypoint.…" 24 hours ago Up 23 hours 80/tcp squest_maintenance_1
The database isn't started. I have an error for db service
[[email protected] squest]# docker-compose logs -f db
Attaching to squest_db_1
db_1 | 2022-09-29 13:32:29+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
db_1 | 2022-09-29 13:32:29+00:00 [ERROR] [Entrypoint]: mariadbd failed while attempting to check config
db_1 | command was: mariadbd --verbose --help --log-bin-index=/tmp/tmp.1mcnSd4wDn
db_1 | Can't initialize timers
db_1 | 2022-09-29 13:33:37+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
db_1 | 2022-09-29 13:33:37+00:00 [ERROR] [Entrypoint]: mariadbd failed while attempting to check config
db_1 | command was: mariadbd --verbose --help --log-bin-index=/tmp/tmp.BgFSwpU3Bi
db_1 | Can't initialize timers
db_1 | 2022-09-30 08:06:24+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.3+maria~ubu2204 started.
db_1 | 2022-09-30 08:06:24+00:00 [ERROR] [Entrypoint]: mariadbd failed while attempting to check config
db_1 | command was: mariadbd --verbose --help --log-bin-index=/tmp/tmp.bkZFKjSNiw
db_1 | Can't initialize timers
squest_db_1 exited with code 1
**Expected behavior**
db starting correctly and Squest is Up
**Additional context**
here the content of : ./docker/environnement_variables/db.env
MYSQL_DATABASE=squest_db
MYSQL_USER=squest_user
MYSQL_PASSWORD=squest_password
MYSQL_ROOT_PAS[email protected]
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306
is it a problem with the db config ?
I try with MYSQL_HOST, MYSQL_PORT and without
- Squest version 1.7.5:
- Ansible Tower/AWX version: NA
Describe the bug Squest throw an exception when an AWX survey have either 'multiple select' or 'multiple select multiple' type of field.
To Reproduce Steps to reproduce the behavior:
'list' object has no attribute 'splitlines'
Expected behavior Survey can be displayed
Errors
Request Method: | GET
-- | --
http://squest.example.com/ui/service_catalog/service/6/operation/4/request/
3.2.13
AttributeError
'list' object has no attribute 'splitlines'
/app/service_catalog/forms/utils.py, line 25, in get_choices_from_string
/usr/local/bin/python
3.10.6
['/app', '/app/squest', '/usr/local/lib/python3.10/site-packages/git/ext/gitdb', '/app', '/usr/local/bin', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/usr/local/lib/python3.10/site-packages', '/usr/local/lib/python3.10/site-packages/gitdb/ext/smmap']
Mon, 08 Aug 2022 15:17:00 +0200
Traces
Environment:
Request Method: GET
Request URL: http://squest.example.com/ui/service_catalog/service/6/operation/4/request/
Django Version: 3.2.13
Python Version: 3.10.6
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'django_celery_results',
'django_celery_beat',
'guardian',
'tempus_dominus',
'django_node_assets',
'django_filters',
'drf_yasg',
'taggit',
'martor',
'django_tables2',
'dbbackup',
'service_catalog',
'resource_tracker',
'profiles',
'monitoring',
'cachalot',
'django_cleanup.apps.CleanupConfig']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'Squest.middleware.maintenance.MaintenanceMiddleware']
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/app/service_catalog/views/customer/catalog_views.py", line 30, in customer_service_request
form = ServiceRequestForm(request.user, **parameters)
File "/app/service_catalog/forms/service_request_forms.py", line 62, in __init__
self.fields.update(get_fields_from_survey(purged_survey_with_validator))
File "/app/service_catalog/forms/utils.py", line 80, in get_fields_from_survey
choices=get_choices_from_string(survey_field["choices"]),
File "/app/service_catalog/forms/utils.py", line 25, in get_choices_from_string
split_lines = string_with_anti_slash_n.splitlines()
Exception Type: AttributeError at /ui/service_catalog/service/6/operation/4/request/
Exception Value: 'list' object has no attribute 'splitlines'
Version
Description of the feature Our ansible playbook can install multiple servers in parallel. I would like to see that possibility to install multiple instances with the same configuration in one go.
Multiple server installs are not possible today if I understand it correctly.
featureDescribe the bug If I try to process a service from the catalog I receive the following error: Exception Value: 'NoneType' object has no attribute 'name' service_catalog/views/common.py, line 78, in create_pie_chart_instance_by_service_type
I don't use any billing groups nor resources. Just use the default value for the service
To Reproduce Steps to reproduce the behavior:
Expected behavior No error
Screenshots
Additional context
Bug appear after processing a request with the "Demo job template"
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/request/10/process/
Django Version: 3.1.7
Python Version: 3.8.10
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'fontawesome-free',
'django_celery_results',
'django_celery_beat',
'guardian',
'django_node_assets',
'django_filters',
'drf_yasg',
'service_catalog',
'resource_tracker']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/home/anthony/.cache/pypoetry/virtualenvs/tower-service-catalog--Kn3-9f8-py3.8/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/anthony/.cache/pypoetry/virtualenvs/tower-service-catalog--Kn3-9f8-py3.8/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/anthony/.cache/pypoetry/virtualenvs/tower-service-catalog--Kn3-9f8-py3.8/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/anthony/HPE/squest/service_catalog/views/admin/request.py", line 162, in admin_request_process
target_request.perform_processing()
File "/home/anthony/.cache/pypoetry/virtualenvs/tower-service-catalog--Kn3-9f8-py3.8/lib/python3.8/site-packages/django_fsm/__init__.py", line 520, in _change_state
return fsm_meta.field.change_state(instance, func, *args, **kwargs)
File "/home/anthony/.cache/pypoetry/virtualenvs/tower-service-catalog--Kn3-9f8-py3.8/lib/python3.8/site-packages/django_fsm/__init__.py", line 326, in change_state
result = method(instance, *args, **kwargs)
File "/home/anthony/HPE/squest/service_catalog/models/request.py", line 105, in perform_processing
tower_job_id = self.operation.job_template.execute(extra_vars=tower_extra_vars)
File "/home/anthony/HPE/squest/service_catalog/models/job_templates.py", line 22, in execute
return tower_job_run.id
Exception Type: AttributeError at /admin/request/10/process/
Exception Value: 'NoneType' object has no attribute 'id'
bug
Multiselect, text area, password, integer and float fields have been added. The initial values and validators were mapped with values defined in survey spec.
As an example, I order a new service "Virtal Machine". The AWX survey ask therefore options like name, CPU and memory. Later I'll update the existing instance using the update operation, the CPU and memory field are prefilled with the current value from specs.
featureIt'd be nice to have details (i.e. username, email, etc) of the user submitting the request filled into ansible vars.
I'm using squest -> awx to provision vm in vcenter environment and I'd like to set vm attributes to specify contact person and other details: I can set those attributes via ansible, but in this case I'm missing user's value.
In the squest part of the payload I can just see squest user id (squest.user field) while variables as "awx_user_name" or "awx_user_email" are filled with details of the awx user been impersonated by awx application.
From time to time we need to provide "time bounded" resources, like vm for students that we need to delete after a certain period of time.
It'd be nice to have a mapping between groups/resource types where admin could specify whenever expiration date is mandatory during request.
Deletion of resources would obviously happen as is done at the moment, invoking a specific playbook, but with a scheduled job server side without human intervention.
The page is useless in its curent state. We never use it.
Todo:
As a end user I would like to:
We need a value to calculate the cost of each service. For example vCPU of a VM converted as $ per day.
Need to take into account a change of the value itself in time as well as the change of the spec of an instance (added vcpu on a vm)
featureRequest
object were not deleted when deleting Request
(Fix and cleanup migration).fill_in_survey
was saved as string instead of dictspec
/user_spec
--> instance
. Impacted pages:
django-forms-dynamic Resolve form field arguments dynamically when a form is instantiated, not when it's declared. Tested against Django 2.2, 3.2 and
A simple REST API to manage postal addresses, written in Python/Django.
Django Filter Django-filter is a reusable Django application allowing users to declaratively add dynamic QuerySet filtering from URL parameters. Full
Django Serverless Cron - Run cron jobs easily in a serverless environment
Installation Installing from PyPI is as easy as doing: pip install django-storages If you'd prefer to install from source (maybe there is a bugfix in
Django-React-Templatetags This django library allows you to add React (16+) components into your django templates. Features Include react components u
django-audit Django Audit is a simple Django app that tracks and logs requests to your application. Quick Start Install django-audit pip install dj-au
AUES Student Management System (L M S ) AUES Student Management System Developed for laboratory works №9 Purpose using Python (Django). I've created t
django-paypal a simple page with paypal payment and confiramtion in django Youtube Video : Paypal Smart Button : https://developer.paypal.com/demo/che
django_compat_lint -- check Django compatibility of your code Django's API stability policy is nice, but there are still things that change from one v
Features Python 2.7, 3.4, Django 2.0+ support (Django 1.11 (LTS), is supported until django-autocomplete-light-3.2.10), Django (multiple) choice suppo
🔍 Django migrations checker A GitHub Action for checking Django migrations About This repository contains a Github Action that checks Django migratio
django-reversion django-reversion is an extension to the Django web framework that provides version control for model instances. Requirements Python 3
Pizza Chatbot To start the app, follow the below steps: Clone the repo using the below command: git clone 1 Jul 15, 2021
django-usso Ugly single sign-on for django projects only. Do you have many django apps with different users? Do you want to use only one of those apps
Учебный проект для закрепления основ Django Подробный разбор проекта здесь. Инструкция по запуску проекта на своей машине: Скачиваем репозиторий Устан
django-huey This package is an extension of huey contrib djhuey package that allows users to manage multiple queues. Installation Using pip package ma
Wagtail - Vue - Django : The initial environment of full-stack local dev web app with wagtail and vue. A demo to show how to use .vue files inside django app.
Django Compressor Django Compressor processes, combines and minifies linked and inline Javascript or CSS in a Django template into cacheable static fi
DjangoPolls A Simple Polling app made with Django Instructions Make sure you have Python installed Step 1. Open a terminal Step 2. Paste the given cod