mirror of
https://github.com/YunoHost-Apps/pyinventory_ynh.git
synced 2024-09-03 20:16:09 +02:00
WIP
This commit is contained in:
parent
7a5affcbb4
commit
049c599f19
17 changed files with 240 additions and 214 deletions
|
@ -10,7 +10,7 @@ trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.py]
|
[*.py]
|
||||||
line_length = 119
|
max_line_length = 120
|
||||||
|
|
||||||
[{Makefile,**.mk}]
|
[{Makefile,**.mk}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
@ -18,4 +18,3 @@ insert_final_newline = false
|
||||||
|
|
||||||
[*.yml]
|
[*.yml]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
|
||||||
|
|
5
.github/workflows/pytest.yml
vendored
5
.github/workflows/pytest.yml
vendored
|
@ -27,6 +27,11 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: '${{ matrix.python-version }}'
|
python-version: '${{ matrix.python-version }}'
|
||||||
|
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cache/
|
||||||
|
key: dot-cache-files
|
||||||
|
|
||||||
- name: 'Install package'
|
- name: 'Install package'
|
||||||
run: |
|
run: |
|
||||||
pip3 install poetry
|
pip3 install poetry
|
||||||
|
|
195
README.md
195
README.md
|
@ -1,195 +0,0 @@
|
||||||
# PyInventory for YunoHost
|
|
||||||
|
|
||||||
[![Integration level](https://dash.yunohost.org/integration/pyinventory.svg)](https://dash.yunohost.org/appci/app/pyinventory) [![CI Pipeline](https://ci-apps.yunohost.org/ci/badges/pyinventory.status.svg)](https://ci-apps.yunohost.org/ci/apps/pyinventory/) [![Maintain status](https://ci-apps.yunohost.org/ci/badges/pyinventory.maintain.svg)](https://dash.yunohost.org/appci/app/pyinventory)
|
|
||||||
|
|
||||||
[![pytest](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/pytest.yml/badge.svg?branch=master)](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/pytest.yml) [![YunoHost apps package linter](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/package_linter.yml/badge.svg)](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/package_linter.yml) [![Coverage Status on codecov.io](https://codecov.io/gh/YunoHost-Apps/pyinventory_ynh/branch/master/graph/badge.svg)](https://codecov.io/gh/YunoHost-Apps/pyinventory_ynh)
|
|
||||||
|
|
||||||
[![Install PyInventory with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pyinventory)
|
|
||||||
|
|
||||||
> *This package allows you to install PyInventory quickly and simply on a YunoHost server.
|
|
||||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
|
||||||
|
|
||||||
Pull requests welcome ;)
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
[PyInventory](https://github.com/jedie/PyInventory) is a libre web-based management to catalog things including state and location etc. using [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/).
|
|
||||||
|
|
||||||
This package for YunoHost used [django-yunohost-integration](https://github.com/YunoHost-Apps/django_yunohost_integration)
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
More screenshots are here: [jedie.github.io/tree/master/screenshots/PyInventory](https://github.com/jedie/jedie.github.io/blob/master/screenshots/PyInventory/README.creole)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
![PyInventory v0.2.0](https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/PyInventory/PyInventory%20v0.2.0%20screenshot%201.png)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
![PyInventory v0.1.0 screenshot 2](https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/PyInventory/PyInventory%20v0.1.0%20screenshot%202.png)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
![PyInventory v0.11.0 screenshot memo](https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/PyInventory/PyInventory%20v0.11.0%20screenshot%20memo%201.png)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
![PyInventory v0.1.0 screenshot 3](https://raw.githubusercontent.com/jedie/jedie.github.io/master/screenshots/PyInventory/PyInventory%20v0.1.0%20screenshot%203.png)
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
More screenshots are here: [jedie.github.io/tree/master/screenshots/PyInventory](https://github.com/jedie/jedie.github.io/blob/master/screenshots/PyInventory/README.creole)
|
|
||||||
|
|
||||||
## Settings and upgrades
|
|
||||||
|
|
||||||
Almost everything related to PyInventory's configuration is handled in a `"../conf/settings.py"` file.
|
|
||||||
You can edit the file `/opt/yunohost/pyinventory/local_settings.py` to enable or disable features.
|
|
||||||
|
|
||||||
Test sending emails:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
ssh admin@yourdomain.tld
|
|
||||||
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
|
||||||
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
|
||||||
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py sendtestemail --admins
|
|
||||||
```
|
|
||||||
|
|
||||||
Background info: Error mails are send to all [settings.ADMINS](https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-ADMINS). By default the YunoHost admin is inserted here.
|
|
||||||
To check current ADMINS run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py sendtestemail --admins
|
|
||||||
```
|
|
||||||
|
|
||||||
If you prefere to send error emails to a extrnal email address, just do something like this:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
echo "ADMINS = (('Your Name', 'example@domain.tld'),)" >> /opt/yunohost/pyinventory/local_settings.py
|
|
||||||
```
|
|
||||||
|
|
||||||
To check the effective settings, run this:
|
|
||||||
```bash
|
|
||||||
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py diffsettings
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# Miscellaneous
|
|
||||||
|
|
||||||
|
|
||||||
## SSO authentication
|
|
||||||
|
|
||||||
[SSOwat](https://github.com/YunoHost/SSOwat) is fully supported via [django-yunohost-integration](https://github.com/YunoHost-Apps/django_yunohost_integration):
|
|
||||||
|
|
||||||
* First user (`$YNH_APP_ARG_ADMIN`) will be created as Django's super user
|
|
||||||
* All new users will be created as normal users
|
|
||||||
* Login via SSO is fully supported
|
|
||||||
* User Email, First / Last name will be updated from SSO data
|
|
||||||
|
|
||||||
|
|
||||||
## Links
|
|
||||||
|
|
||||||
* Report a bug about this package: https://github.com/YunoHost-Apps/pyinventory_ynh
|
|
||||||
* Report a bug about PyInventory itself: https://github.com/jedie/PyInventory
|
|
||||||
* YunoHost website: https://yunohost.org/
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Developer info
|
|
||||||
|
|
||||||
## package installation / debugging
|
|
||||||
|
|
||||||
Please send your pull request to https://github.com/YunoHost-Apps/pyinventory_ynh
|
|
||||||
|
|
||||||
Try 'main' branch, e.g.:
|
|
||||||
```bash
|
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/pyinventory_ynh/tree/master --debug
|
|
||||||
or
|
|
||||||
sudo yunohost app upgrade pyinventory -u https://github.com/YunoHost-Apps/pyinventory_ynh/tree/master --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
Try 'testing' branch, e.g.:
|
|
||||||
```bash
|
|
||||||
sudo yunohost app install https://github.com/YunoHost-Apps/pyinventory_ynh/tree/testing --debug
|
|
||||||
or
|
|
||||||
sudo yunohost app upgrade pyinventory -u https://github.com/YunoHost-Apps/pyinventory_ynh/tree/testing --debug
|
|
||||||
```
|
|
||||||
|
|
||||||
To remove call e.g.:
|
|
||||||
```bash
|
|
||||||
sudo yunohost app remove pyinventory
|
|
||||||
```
|
|
||||||
|
|
||||||
Backup / remove / restore cycle, e.g.:
|
|
||||||
```bash
|
|
||||||
yunohost backup create --apps pyinventory
|
|
||||||
yunohost backup list
|
|
||||||
archives:
|
|
||||||
- pyinventory-pre-upgrade1
|
|
||||||
- 20201223-163434
|
|
||||||
yunohost app remove pyinventory
|
|
||||||
yunohost backup restore 20201223-163434 --apps pyinventory
|
|
||||||
```
|
|
||||||
|
|
||||||
Debug installation, e.g.:
|
|
||||||
```bash
|
|
||||||
root@yunohost:~# ls -la /var/www/pyinventory/
|
|
||||||
total 18
|
|
||||||
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
|
||||||
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
|
||||||
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
|
||||||
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
|
||||||
|
|
||||||
root@yunohost:~# ls -la /opt/yunohost/pyinventory/
|
|
||||||
total 58
|
|
||||||
drwxr-xr-x 5 pyinventory pyinventory 11 Dec 8 08:39 .
|
|
||||||
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
|
||||||
-rw-r--r-- 1 pyinventory pyinventory 460 Dec 8 08:39 gunicorn.conf.py
|
|
||||||
-rw-r--r-- 1 pyinventory pyinventory 0 Dec 8 08:39 local_settings.py
|
|
||||||
-rwxr-xr-x 1 pyinventory pyinventory 274 Dec 8 08:39 manage.py
|
|
||||||
-rw-r--r-- 1 pyinventory pyinventory 171 Dec 8 08:39 secret.txt
|
|
||||||
drwxr-xr-x 6 pyinventory pyinventory 6 Dec 8 08:37 venv
|
|
||||||
-rw-r--r-- 1 pyinventory pyinventory 115 Dec 8 08:39 wsgi.py
|
|
||||||
-rw-r--r-- 1 pyinventory pyinventory 4737 Dec 8 08:39 settings.py
|
|
||||||
|
|
||||||
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
|
||||||
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
|
||||||
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py check
|
|
||||||
PyInventory v0.8.2 (Django v2.2.17)
|
|
||||||
DJANGO_SETTINGS_MODULE='settings'
|
|
||||||
PROJECT_PATH:/opt/yunohost/pyinventory/venv/lib/python3.7/site-packages
|
|
||||||
BASE_PATH:/opt/yunohost/pyinventory
|
|
||||||
System check identified no issues (0 silenced).
|
|
||||||
|
|
||||||
root@yunohost:~# tail -f /var/log/pyinventory/pyinventory.log
|
|
||||||
root@yunohost:~# cat /etc/systemd/system/pyinventory.service
|
|
||||||
|
|
||||||
root@yunohost:~# systemctl reload-or-restart pyinventory
|
|
||||||
root@yunohost:~# journalctl --unit=pyinventory --follow
|
|
||||||
```
|
|
||||||
|
|
||||||
## local test
|
|
||||||
|
|
||||||
For quicker developing of PyInventory in the context of YunoHost app,
|
|
||||||
it's possible to run the Django developer server with the settings
|
|
||||||
and urls made for YunoHost installation.
|
|
||||||
|
|
||||||
e.g.:
|
|
||||||
```bash
|
|
||||||
~$ git clone https://github.com/YunoHost-Apps/pyinventory_ynh.git
|
|
||||||
~$ cd pyinventory_ynh/
|
|
||||||
~/pyinventory_ynh$ make
|
|
||||||
install-poetry install or update poetry
|
|
||||||
install install PyInventory via poetry
|
|
||||||
update update the sources and installation
|
|
||||||
local-test Run local_test.py to run pyinventory_ynh locally
|
|
||||||
~/pyinventory_ynh$ make install-poetry
|
|
||||||
~/pyinventory_ynh$ make install
|
|
||||||
~/pyinventory_ynh$ make local-test
|
|
||||||
```
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
* SQlite database will be used
|
|
||||||
* A super user with username `test` and password `test` is created
|
|
||||||
* The page is available under `http://127.0.0.1:8000/app_path/`
|
|
|
@ -75,8 +75,8 @@ MANAGERS = ADMINS
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': '__APP__',
|
'NAME': '__DB_NAME__',
|
||||||
'USER': '__APP__',
|
'USER': '__DB_USER__',
|
||||||
'PASSWORD': '__DB_PWD__',
|
'PASSWORD': '__DB_PWD__',
|
||||||
'HOST': '127.0.0.1',
|
'HOST': '127.0.0.1',
|
||||||
'PORT': '5432', # Default Postgres Port
|
'PORT': '5432', # Default Postgres Port
|
||||||
|
|
15
doc/DESCRIPTION.md
Normal file
15
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[PyInventory](https://github.com/jedie/PyInventory) is a libre web-based management to catalog things including state and location etc. using [Python](https://www.python.org/)/[Django](https://www.djangoproject.com/).
|
||||||
|
|
||||||
|
[![Integration level](https://dash.yunohost.org/integration/pyinventory.svg)](https://dash.yunohost.org/appci/app/pyinventory) [![CI Pipeline](https://ci-apps.yunohost.org/ci/badges/pyinventory.status.svg)](https://ci-apps.yunohost.org/ci/apps/pyinventory/) [![Maintain status](https://ci-apps.yunohost.org/ci/badges/pyinventory.maintain.svg)](https://dash.yunohost.org/appci/app/pyinventory)
|
||||||
|
|
||||||
|
[![pytest](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/pytest.yml/badge.svg?branch=master)](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/pytest.yml) [![YunoHost apps package linter](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/package_linter.yml/badge.svg)](https://github.com/YunoHost-Apps/pyinventory_ynh/actions/workflows/package_linter.yml) [![Coverage Status on codecov.io](https://codecov.io/gh/YunoHost-Apps/pyinventory_ynh/branch/master/graph/badge.svg)](https://codecov.io/gh/YunoHost-Apps/pyinventory_ynh)
|
||||||
|
|
||||||
|
![pyinventory @ PyPi](https://img.shields.io/pypi/v/pyinventory?label=pyinventory%20%40%20PyPi)
|
||||||
|
![Python Versions](https://img.shields.io/pypi/pyversions/pyinventory)
|
||||||
|
![License GPL V3+](https://img.shields.io/pypi/l/pyinventory)
|
||||||
|
|
||||||
|
Pull requests welcome ;)
|
||||||
|
|
||||||
|
This package for YunoHost used [django-yunohost-integration](https://github.com/YunoHost-Apps/django_yunohost_integration)
|
||||||
|
|
||||||
|
More screenshots are here: jedie.github.io/tree/master/screenshots/PyInventory
|
152
doc/DISCLAIMER.md
Normal file
152
doc/DISCLAIMER.md
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
## Settings and upgrades
|
||||||
|
|
||||||
|
Almost everything related to PyInventory's configuration is handled in a `"../conf/settings.py"` file.
|
||||||
|
You can edit the file `/opt/yunohost/pyinventory/local_settings.py` to enable or disable features.
|
||||||
|
|
||||||
|
Test sending emails:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ssh admin@yourdomain.tld
|
||||||
|
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
||||||
|
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
||||||
|
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py sendtestemail --admins
|
||||||
|
```
|
||||||
|
|
||||||
|
Background info: Error mails are send to all [settings.ADMINS](https://docs.djangoproject.com/en/2.2/ref/settings/#std:setting-ADMINS). By default the YunoHost admin is inserted here.
|
||||||
|
To check current ADMINS run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py sendtestemail --admins
|
||||||
|
```
|
||||||
|
|
||||||
|
If you prefere to send error emails to a extrnal email address, just do something like this:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "ADMINS = (('Your Name', 'example@domain.tld'),)" >> /opt/yunohost/pyinventory/local_settings.py
|
||||||
|
```
|
||||||
|
|
||||||
|
To check the effective settings, run this:
|
||||||
|
```bash
|
||||||
|
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py diffsettings
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
|
||||||
|
|
||||||
|
## SSO authentication
|
||||||
|
|
||||||
|
[SSOwat](https://github.com/YunoHost/SSOwat) is fully supported via [django-yunohost-integration](https://github.com/YunoHost-Apps/django_yunohost_integration):
|
||||||
|
|
||||||
|
* First user (`$YNH_APP_ARG_ADMIN`) will be created as Django's super user
|
||||||
|
* All new users will be created as normal users
|
||||||
|
* Login via SSO is fully supported
|
||||||
|
* User Email, First / Last name will be updated from SSO data
|
||||||
|
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
* Report a bug about this package: https://github.com/YunoHost-Apps/pyinventory_ynh
|
||||||
|
* Report a bug about PyInventory itself: https://github.com/jedie/PyInventory
|
||||||
|
* YunoHost website: https://yunohost.org/
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Developer info
|
||||||
|
|
||||||
|
## package installation / debugging
|
||||||
|
|
||||||
|
Please send your pull request to https://github.com/YunoHost-Apps/pyinventory_ynh
|
||||||
|
|
||||||
|
Try 'main' branch, e.g.:
|
||||||
|
```bash
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/pyinventory_ynh/tree/master --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade pyinventory -u https://github.com/YunoHost-Apps/pyinventory_ynh/tree/master --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
Try 'testing' branch, e.g.:
|
||||||
|
```bash
|
||||||
|
sudo yunohost app install https://github.com/YunoHost-Apps/pyinventory_ynh/tree/testing --debug
|
||||||
|
or
|
||||||
|
sudo yunohost app upgrade pyinventory -u https://github.com/YunoHost-Apps/pyinventory_ynh/tree/testing --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
To remove call e.g.:
|
||||||
|
```bash
|
||||||
|
sudo yunohost app remove pyinventory
|
||||||
|
```
|
||||||
|
|
||||||
|
Backup / remove / restore cycle, e.g.:
|
||||||
|
```bash
|
||||||
|
yunohost backup create --apps pyinventory
|
||||||
|
yunohost backup list
|
||||||
|
archives:
|
||||||
|
- pyinventory-pre-upgrade1
|
||||||
|
- 20201223-163434
|
||||||
|
yunohost app remove pyinventory
|
||||||
|
yunohost backup restore 20201223-163434 --apps pyinventory
|
||||||
|
```
|
||||||
|
|
||||||
|
Debug installation, e.g.:
|
||||||
|
```bash
|
||||||
|
root@yunohost:~# ls -la /var/www/pyinventory/
|
||||||
|
total 18
|
||||||
|
drwxr-xr-x 4 root root 4 Dec 8 08:36 .
|
||||||
|
drwxr-xr-x 6 root root 6 Dec 8 08:36 ..
|
||||||
|
drwxr-xr-x 2 root root 2 Dec 8 08:36 media
|
||||||
|
drwxr-xr-x 7 root root 8 Dec 8 08:40 static
|
||||||
|
|
||||||
|
root@yunohost:~# ls -la /opt/yunohost/pyinventory/
|
||||||
|
total 58
|
||||||
|
drwxr-xr-x 5 pyinventory pyinventory 11 Dec 8 08:39 .
|
||||||
|
drwxr-xr-x 3 root root 3 Dec 8 08:36 ..
|
||||||
|
-rw-r--r-- 1 pyinventory pyinventory 460 Dec 8 08:39 gunicorn.conf.py
|
||||||
|
-rw-r--r-- 1 pyinventory pyinventory 0 Dec 8 08:39 local_settings.py
|
||||||
|
-rwxr-xr-x 1 pyinventory pyinventory 274 Dec 8 08:39 manage.py
|
||||||
|
-rw-r--r-- 1 pyinventory pyinventory 171 Dec 8 08:39 secret.txt
|
||||||
|
drwxr-xr-x 6 pyinventory pyinventory 6 Dec 8 08:37 venv
|
||||||
|
-rw-r--r-- 1 pyinventory pyinventory 115 Dec 8 08:39 wsgi.py
|
||||||
|
-rw-r--r-- 1 pyinventory pyinventory 4737 Dec 8 08:39 settings.py
|
||||||
|
|
||||||
|
root@yunohost:~# cd /opt/yunohost/pyinventory/
|
||||||
|
root@yunohost:/opt/yunohost/pyinventory# source venv/bin/activate
|
||||||
|
(venv) root@yunohost:/opt/yunohost/pyinventory# ./manage.py check
|
||||||
|
PyInventory v0.8.2 (Django v2.2.17)
|
||||||
|
DJANGO_SETTINGS_MODULE='settings'
|
||||||
|
PROJECT_PATH:/opt/yunohost/pyinventory/venv/lib/python3.7/site-packages
|
||||||
|
BASE_PATH:/opt/yunohost/pyinventory
|
||||||
|
System check identified no issues (0 silenced).
|
||||||
|
|
||||||
|
root@yunohost:~# tail -f /var/log/pyinventory/pyinventory.log
|
||||||
|
root@yunohost:~# cat /etc/systemd/system/pyinventory.service
|
||||||
|
|
||||||
|
root@yunohost:~# systemctl reload-or-restart pyinventory
|
||||||
|
root@yunohost:~# journalctl --unit=pyinventory --follow
|
||||||
|
```
|
||||||
|
|
||||||
|
## local test
|
||||||
|
|
||||||
|
For quicker developing of PyInventory in the context of YunoHost app,
|
||||||
|
it's possible to run the Django developer server with the settings
|
||||||
|
and urls made for YunoHost installation.
|
||||||
|
|
||||||
|
e.g.:
|
||||||
|
```bash
|
||||||
|
~$ git clone https://github.com/YunoHost-Apps/pyinventory_ynh.git
|
||||||
|
~$ cd pyinventory_ynh/
|
||||||
|
~/pyinventory_ynh$ make
|
||||||
|
install-poetry install or update poetry
|
||||||
|
install install PyInventory via poetry
|
||||||
|
update update the sources and installation
|
||||||
|
local-test Run local_test.py to run pyinventory_ynh locally
|
||||||
|
~/pyinventory_ynh$ make install-poetry
|
||||||
|
~/pyinventory_ynh$ make install
|
||||||
|
~/pyinventory_ynh$ make local-test
|
||||||
|
```
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
* SQlite database will be used
|
||||||
|
* A super user with username `test` and password `test` is created
|
||||||
|
* The page is available under `http://127.0.0.1:8000/app_path/`
|
0
doc/screenshots/gitkeep
Normal file
0
doc/screenshots/gitkeep
Normal file
BIN
doc/screenshots/pyinventory_v010_screenshot_2.png
Normal file
BIN
doc/screenshots/pyinventory_v010_screenshot_2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 KiB |
BIN
doc/screenshots/pyinventory_v010_screenshot_3.png
Normal file
BIN
doc/screenshots/pyinventory_v010_screenshot_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
BIN
doc/screenshots/pyinventory_v0110_screenshot_memo_1.png
Normal file
BIN
doc/screenshots/pyinventory_v0110_screenshot_memo_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 216 KiB |
BIN
doc/screenshots/pyinventory_v020_screenshot_1.png
Normal file
BIN
doc/screenshots/pyinventory_v020_screenshot_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 124 KiB |
|
@ -7,6 +7,11 @@
|
||||||
},
|
},
|
||||||
"version": "0.14.0~ynh1",
|
"version": "0.14.0~ynh1",
|
||||||
"url": "https://github.com/jedie/PyInventory",
|
"url": "https://github.com/jedie/PyInventory",
|
||||||
|
"upstream": {
|
||||||
|
"license": "GPL-3.0",
|
||||||
|
"website": "https://github.com/jedie/PyInventory",
|
||||||
|
"code": "https://github.com/jedie/PyInventory"
|
||||||
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "Jens Diemer",
|
"name": "Jens Diemer",
|
||||||
|
@ -14,7 +19,7 @@
|
||||||
},
|
},
|
||||||
"previous_maintainers": [],
|
"previous_maintainers": [],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.0"
|
"yunohost": ">= 4.4"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
@ -24,8 +29,7 @@
|
||||||
"install" : [
|
"install" : [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "domain.org"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
@ -35,9 +39,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user"
|
||||||
"example": "johndoe"
|
}
|
||||||
}
|
]
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
poetry.lock
generated
14
poetry.lock
generated
|
@ -464,6 +464,14 @@ category = "dev"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = "*"
|
python-versions = "*"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "editorconfig"
|
||||||
|
version = "0.12.3"
|
||||||
|
description = "EditorConfig File Locator and Interpreter for Python"
|
||||||
|
category = "dev"
|
||||||
|
optional = false
|
||||||
|
python-versions = "*"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "et-xmlfile"
|
name = "et-xmlfile"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
@ -1123,7 +1131,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = ">=3.7,<4.0.0"
|
python-versions = ">=3.7,<4.0.0"
|
||||||
content-hash = "476528099d63f6382ff7d45a8cbabf9636fcc58b21fa82aa5687218df43a8a8b"
|
content-hash = "55a6bb103d5ba4398f3a8968b32297d65abee31751e3bcc2989eb883663bddc0"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
asgiref = [
|
asgiref = [
|
||||||
|
@ -1336,6 +1344,10 @@ django-yunohost-integration = [
|
||||||
docopt = [
|
docopt = [
|
||||||
{file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"},
|
{file = "docopt-0.6.2.tar.gz", hash = "sha256:49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"},
|
||||||
]
|
]
|
||||||
|
editorconfig = [
|
||||||
|
{file = "EditorConfig-0.12.3-py3-none-any.whl", hash = "sha256:6b0851425aa875b08b16789ee0eeadbd4ab59666e9ebe728e526314c4a2e52c1"},
|
||||||
|
{file = "EditorConfig-0.12.3.tar.gz", hash = "sha256:57f8ce78afcba15c8b18d46b5170848c88d56fd38f05c2ec60dbbfcb8996e89e"},
|
||||||
|
]
|
||||||
et-xmlfile = [
|
et-xmlfile = [
|
||||||
{file = "et_xmlfile-1.1.0-py3-none-any.whl", hash = "sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada"},
|
{file = "et_xmlfile-1.1.0-py3-none-any.whl", hash = "sha256:a2ba85d1d6a74ef63837eed693bcb89c3f752169b0e3e7ae5b16ca5e1b3deada"},
|
||||||
{file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"},
|
{file = "et_xmlfile-1.1.0.tar.gz", hash = "sha256:8eb9e2bc2f8c97e37a2dc85a09ecdcdec9d8a396530a6d5a33b30b9a92da0c5c"},
|
||||||
|
|
|
@ -6,6 +6,7 @@ authors = ["JensDiemer <git@jensdiemer.de>"]
|
||||||
license = "GPL"
|
license = "GPL"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
|
# Keep Python 3.7 until Yunohost contains a newer Python Version ;)
|
||||||
python = ">=3.7,<4.0.0"
|
python = ">=3.7,<4.0.0"
|
||||||
pyinventory = {version = ">=0.14.0", extras = ["psycopg2-source"]}
|
pyinventory = {version = ">=0.14.0", extras = ["psycopg2-source"]}
|
||||||
|
|
||||||
|
@ -28,9 +29,10 @@ pytest-isort = "*"
|
||||||
coveralls = "*"
|
coveralls = "*"
|
||||||
flynt = "*"
|
flynt = "*"
|
||||||
pyupgrade = "*"
|
pyupgrade = "*"
|
||||||
|
EditorConfig = "*" # https://github.com/editorconfig/editorconfig-core-py
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ addopts = """
|
||||||
legacy_tox_ini = """
|
legacy_tox_ini = """
|
||||||
[tox]
|
[tox]
|
||||||
isolated_build = True
|
isolated_build = True
|
||||||
envlist = py39,py38,py37
|
envlist = px310,py39,py38,py37
|
||||||
skip_missing_interpreters = True
|
skip_missing_interpreters = True
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
|
|
@ -142,6 +142,8 @@ settings="$final_path/settings.py"
|
||||||
cp "../conf/settings.py" "$settings"
|
cp "../conf/settings.py" "$settings"
|
||||||
|
|
||||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||||
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$settings"
|
||||||
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
|
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
|
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
|
||||||
|
|
|
@ -21,7 +21,11 @@ domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||||
|
|
||||||
port=$(ynh_app_setting_get --app="$app" --key=port)
|
port=$(ynh_app_setting_get --app="$app" --key=port)
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
||||||
|
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
||||||
|
db_user=$db_name
|
||||||
|
|
||||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||||
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
||||||
|
|
||||||
|
@ -130,6 +134,8 @@ ynh_backup_if_checksum_is_different --file="$settings"
|
||||||
cp "../conf/settings.py" "$settings"
|
cp "../conf/settings.py" "$settings"
|
||||||
|
|
||||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||||
|
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$settings"
|
||||||
|
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
|
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
|
||||||
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
|
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
|
||||||
|
|
|
@ -4,7 +4,8 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from bx_py_utils.path import assert_is_file
|
from django_tools.serve_media_app.utils import clean_filename
|
||||||
|
from django_tools.unittest_utils.assertments import assert_is_dir, assert_is_file
|
||||||
|
|
||||||
import inventory
|
import inventory
|
||||||
|
|
||||||
|
@ -23,8 +24,12 @@ def assert_file_contains_string(file_path, string):
|
||||||
def test_version():
|
def test_version():
|
||||||
version = inventory.__version__
|
version = inventory.__version__
|
||||||
|
|
||||||
assert_file_contains_string(file_path=Path(PACKAGE_ROOT, 'pyproject.toml'), string=f'version = "{version}~ynh')
|
assert_file_contains_string(
|
||||||
assert_file_contains_string(file_path=Path(PACKAGE_ROOT, 'manifest.json'), string=f'"version": "{version}~ynh')
|
file_path=Path(PACKAGE_ROOT, 'pyproject.toml'), string=f'version = "{version}~ynh'
|
||||||
|
)
|
||||||
|
assert_file_contains_string(
|
||||||
|
file_path=Path(PACKAGE_ROOT, 'manifest.json'), string=f'"version": "{version}~ynh'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def poetry_check_output(*args):
|
def poetry_check_output(*args):
|
||||||
|
@ -32,7 +37,7 @@ def poetry_check_output(*args):
|
||||||
|
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(
|
||||||
(poerty_bin,) + args,
|
(poerty_bin,) + args,
|
||||||
universal_newlines=True,
|
text=True,
|
||||||
env=os.environ,
|
env=os.environ,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
cwd=str(PACKAGE_ROOT),
|
cwd=str(PACKAGE_ROOT),
|
||||||
|
@ -57,8 +62,28 @@ def test_requirements_txt():
|
||||||
|
|
||||||
diff = '\n'.join(
|
diff = '\n'.join(
|
||||||
difflib.unified_diff(
|
difflib.unified_diff(
|
||||||
current_content.splitlines(), output.splitlines(), fromfile=str(requirements_txt), tofile='FRESH EXPORT'
|
current_content.splitlines(),
|
||||||
|
output.splitlines(),
|
||||||
|
fromfile=str(requirements_txt),
|
||||||
|
tofile='FRESH EXPORT',
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print(diff)
|
print(diff)
|
||||||
assert diff == '', f'{requirements_txt} is not up-to-date! (Hint: call: "make update")'
|
assert diff == '', f'{requirements_txt} is not up-to-date! (Hint: call: "make update")'
|
||||||
|
|
||||||
|
|
||||||
|
def test_screenshot_filenames():
|
||||||
|
"""
|
||||||
|
https://forum.yunohost.org/t/yunohost-bot-cant-handle-spaces-in-screenshots/19483
|
||||||
|
"""
|
||||||
|
screenshot_path = PACKAGE_ROOT / 'doc' / 'screenshots'
|
||||||
|
assert_is_dir(screenshot_path)
|
||||||
|
renamed = []
|
||||||
|
for file_path in screenshot_path.iterdir():
|
||||||
|
file_name = file_path.name
|
||||||
|
cleaned_name = clean_filename(file_name)
|
||||||
|
if cleaned_name != file_name:
|
||||||
|
new_path = file_path.with_name(cleaned_name)
|
||||||
|
file_path.rename(new_path)
|
||||||
|
renamed.append(f'{file_name!r} renamed to {cleaned_name!r}')
|
||||||
|
assert not renamed, f'Bad screenshots file names found: {", ".join(renamed)}'
|
||||||
|
|
Loading…
Reference in a new issue