added Readme ans requirements.txt

This commit is contained in:
Kirill Zhukov 2022-12-29 17:00:58 +01:00
parent fb2b1de2c1
commit b266b1b619
3 changed files with 70 additions and 3 deletions

View File

@ -0,0 +1,63 @@
# albs-oval-errata-diff
Service compares RHEL Oval with AlmaLinux Oval/Errata and stores differences. Differences are available via HTTP GET request in form of JSON
## Components
### comparer
Downloads Oval/Errata files and generates differences report
### webserver
Publishes JSON report via aiohttp webserver
## Configuration
check [config.default.yml](config.default.yml) for references
## Requirements
- Python 3.9
- pip
- virtualenv
## Installation
1. Checkout code
```bash
$ git clone git@git.almalinux.org:kzhukov/albs-oval-errata-diff.git
```
2. Create and initialize virtual enviroment
```bash
$ virtualenv -p python3.9 venv && source venv/bin/activate
```
3. Install requirements
```bash
$ pip install -r requirements.txt
```
4. Create config file using [config.default.yml](config.default.yml) and start service with `albs_oval_errata_dif.py` script
```bash
$ python albs_oval_errata_diff.py config.default.yml
2022-12-29 16:20:11,139 INFO start Trying to load diff file from disk
2022-12-29 16:20:11,142 INFO start Diff file was loaded
2022-12-29 16:20:11,142 INFO start Starting diff_checker in background
2022-12-29 16:20:11,143 INFO diff_checker Start comparing
2022-12-29 16:20:11,143 INFO start Starting webserver
2022-12-29 16:20:11,144 INFO comparer_run Processing release 8
2022-12-29 16:20:11,148 INFO comparer_run downloading rhel oval
======== Running on http://127.0.0.1:3001 ========
(Press CTRL+C to quit)
2022-12-29 16:20:12,142 INFO comparer_run parsing rhel oval
2022-12-29 16:20:13,154 INFO comparer_run downloading alma oval
2022-12-29 16:20:16,516 INFO comparer_run parsing alma oval
2022-12-29 16:20:17,695 INFO comparer_run downloading alma errata
2022-12-29 16:20:28,894 INFO comparer_run parsing alma errata
2022-12-29 16:20:29,143 INFO comparer_run comparing rhel and alma
2022-12-29 16:20:29,233 INFO comparer_run Processing release 9
2022-12-29 16:20:29,234 INFO comparer_run downloading rhel oval
2022-12-29 16:20:29,599 INFO comparer_run parsing rhel oval
2022-12-29 16:20:29,716 INFO comparer_run downloading alma oval
2022-12-29 16:20:31,033 INFO comparer_run parsing alma oval
2022-12-29 16:20:31,165 INFO comparer_run downloading alma errata
2022-12-29 16:20:33,542 INFO comparer_run parsing alma errata
2022-12-29 16:20:33,601 INFO comparer_run comparing rhel and alma
2022-12-29 16:20:33,621 INFO diff_checker Finished comparing, updating diff dict
2022-12-29 16:20:33,622 INFO diff_checker Saving results to disk
2022-12-29 16:20:33,630 INFO diff_checker Done
2022-12-29 16:20:33,630 INFO diff_checker Finished comparing, go to sleep for 30 minutes
```

View File

@ -46,7 +46,7 @@ def webserver_run(server_ip: IPv4Address, server_port: str):
def diff_checker(config: Config): def diff_checker(config: Config):
""" """
runs comparer component in infinite loop Runs comparer component in infinite loop
""" """
while True: while True:
logging.info("Start comparing") logging.info("Start comparing")
@ -105,9 +105,9 @@ def start(yaml_path: str):
diffs = loaded_data diffs = loaded_data
diffs_lock.release() diffs_lock.release()
except Exception as err: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except
logging.warning('cant load data from disk %s', err) logging.warning('Cant load data from disk %s', err)
else: else:
logging.info('diff file was loaded') logging.info('Diff file was loaded')
logging.info("Starting diff_checker in background") logging.info("Starting diff_checker in background")
thread = threading.Thread(target=diff_checker, args=(config,)) thread = threading.Thread(target=diff_checker, args=(config,))

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
aiohttp==3.8.3
pydantic==1.10.2
PyYAML==6.0
requests==2.28.1