Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt 3006.3 compatible #507

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ jobs:
- name: Install black
run: pip install black
- name: Build the stack
run: docker-compose -f docker-compose-ci.yml up -d
run: docker compose -f docker-compose-ci.yml up -d
- name: Test
run: bash docker/utils/ci_script.sh
- name: Check safety
if: ${{ success() }}
run: docker-compose exec -T -u alcali web safety check
run: docker compose exec -T -u alcali web safety check
- name: Check format
if: ${{ success() }}
run: black --check .
- name: Upload Codecov
if: ${{ success() }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: docker-compose exec -T -u alcali -e "$env:CODECOV_TOKEN" web codecov -X s3
run: docker compose exec -T -u alcali -e "$env:CODECOV_TOKEN" web codecov -X s3
- name: Show logs
if: ${{ failure() }}
run: docker-compose logs
run: docker compose logs
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim-stretch
FROM python:3.10-bullseye

MAINTAINER Matt Melquiond

Expand All @@ -8,7 +8,7 @@ ARG USER_ID=1000
# Upgrade System and Install dependencies
RUN apt-get update \
&& seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} \
&& apt-get install -y --no-install-recommends -o DPkg::Options::=--force-confold netcat libmariadbclient-dev libpq-dev build-essential libldap2-dev libsasl2-dev ldap-utils git
&& apt-get install -y --no-install-recommends -o DPkg::Options::=--force-confold netcat default-libmysqlclient-dev libpq-dev build-essential libldap2-dev libsasl2-dev ldap-utils git pkg-config

# Upgrade pip
RUN pip install --upgrade pip
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ If you just want to have a look, just clone the [repository](https://github.com/
```commandline
git clone https://github.com/latenighttales/alcali.git
cd alcali
docker-compose up --scale minion=2
docker compose up --scale minion=2
```


Expand Down Expand Up @@ -94,6 +94,12 @@ via GitHub Sponsors, or

## Changelog

## [3006.3.0] dev

- int: bugfix and deps update

- feat: i18n (#353)

## [3003.1.0] - 2021-04-23

- int: updated deps (#317)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3003.1.0
3006.3.0
1 change: 0 additions & 1 deletion api/management/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class Command(BaseCommand):
help = "Check access to database and that env var are set"

def handle(self, *args, **options):

unset = []
for env in [
"MASTER_MINION_ID",
Expand Down
1 change: 0 additions & 1 deletion api/management/commands/current_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ class Command(BaseCommand):
help = "Return Alcali version"

def handle(self, *args, **options):

version = settings.VERSION
self.stdout.write("alcali version {}".format(version))
1 change: 0 additions & 1 deletion api/management/commands/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class Command(BaseCommand):
help = "Return Alcali location"

def handle(self, *args, **options):

current_path = os.path.dirname(os.path.abspath(__file__))
current_path = os.path.abspath(os.path.join(current_path, "..", "..", ".."))
self.stdout.write("{}".format(current_path))
1 change: 0 additions & 1 deletion api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
1 change: 0 additions & 1 deletion api/migrations/0002_jobtemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("api", "0001_initial")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion api/migrations/0003_auto_20200317_1719.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class Migration(migrations.Migration):

dependencies = [("api", "0002_jobtemplate")]
operations = [
migrations.RemoveField(model_name="usersettings", name="max_notifs"),
Expand Down
1 change: 0 additions & 1 deletion api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def conformity(self):
return True

def custom_conformity(self, fun, *args):

# First, filter with fun.
jobs = SaltReturns.objects.filter(fun=fun, id=self.minion_id).order_by(
"-alter_time"
Expand Down
2 changes: 0 additions & 2 deletions api/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@

@receiver(post_save, sender=User)
def create_user_settings(sender, instance, created, **kwargs):

# Create related UserSettings when a new User is created.
if created:
UserSettings.objects.create(user=instance)


@receiver(post_save, sender=User)
def save_user_settings(sender, instance, **kwargs):

# Save UserSettings when user is saved.
instance.user_settings.save()
1 change: 0 additions & 1 deletion api/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def graph_data(period=7, **kwargs):


def render_conformity(target=None):

# First, a list of targets.
if target:
minions_all = [Minions.objects.get(minion_id=target)]
Expand Down
15 changes: 8 additions & 7 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
DATABASES = {
"default": {
"ENGINE": "django.db.backends.{}".format(os.environ["DB_BACKEND"]),
"ATOMIC_REQUESTS": True,
"NAME": os.environ.get("DB_NAME"),
"USER": os.environ.get("DB_USER"),
"PASSWORD": os.environ.get("DB_PASS"),
Expand All @@ -106,7 +107,7 @@

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
Expand Down Expand Up @@ -149,12 +150,12 @@
# 'REFRESH_TOKEN_LIFETIME': timedelta(days=1)}

# # TODO!
# LOGGING = {
# "version": 1,
# "disable_existing_loggers": False,
# "handlers": {"console": {"class": "logging.StreamHandler"}},
# "loggers": {"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}},
# }
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {"console": {"class": "logging.StreamHandler", "level": "DEBUG"}},
"loggers": {"django_auth_ldap": {"level": "DEBUG", "handlers": ["console"]}},
}
#
# Get version from file.
try:
Expand Down
5 changes: 2 additions & 3 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.urls import include
from django.conf.urls import url
from django.urls import include, re_path

urlpatterns = [url(r"^", include("api.urls"))]
urlpatterns = [re_path(r"^", include("api.urls"))]
1 change: 1 addition & 0 deletions docker-compose-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
command: honcho start
depends_on:
- web
- db
environment:
- PYTHONUNBUFFERED=true
ports:
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim-buster
FROM python:3.10-slim-bullseye

MAINTAINER Matt Melquiond

Expand All @@ -8,7 +8,7 @@ ARG USER_ID=1000
# Upgrade System and Install dependencies
RUN apt-get update \
&& seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} \
&& apt-get install -y --no-install-recommends -o DPkg::Options::=--force-confold netcat libmariadbclient-dev libpq-dev build-essential libldap2-dev libsasl2-dev ldap-utils
&& apt-get install -y --no-install-recommends -o DPkg::Options::=--force-confold netcat default-libmysqlclient-dev libpq-dev build-essential libldap2-dev libsasl2-dev ldap-utils pkg-config

# Upgrade pip
RUN pip install --upgrade pip
Expand Down
5 changes: 3 additions & 2 deletions docker/Dockerfile-master
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim-buster
FROM python:3.10-bullseye

# Upgrade System and Install dependencies
RUN apt-get update && \
Expand All @@ -13,8 +13,9 @@ COPY saltconfig/etc/minion /etc/salt/minion
RUN echo "id: master">>/etc/salt/minion

# Install python dependencies
RUN apt-get install -y -o DPkg::Options::=--force-confold salt-api python3-openssl
RUN apt-get install -y -o DPkg::Options::=--force-confold salt-api python3-openssl default-libmysqlclient-dev pkg-config
RUN pip install honcho
RUN salt-pip install mysqlclient

# Copy needed files
COPY saltconfig/etc/master /etc/salt/master
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile-minion
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM python:3.7-slim-buster
FROM python:3.10-bullseye

# Upgrade System and Install dependencies
RUN apt-get update && \
apt-get upgrade -y -o DPkg::Options::=--force-confold && \
apt-get install -y -o DPkg::Options::=--force-confold curl netcat

# Install Latest Salt from the stable Branch
RUN curl -L https://bootstrap.saltstack.com | sh -s -- -x python3 stable latest
RUN curl -L https://bootstrap.saltstack.com | sh -s -- -D -r -P stable

# Set master
COPY saltconfig/etc/minion /etc/salt/minion
Expand Down
34 changes: 28 additions & 6 deletions docker/saltconfig/etc/master
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,22 @@ mysql.port: 3306
# pam:
# fred:
# - test.*
# client_acl:
# admin:
# - .*


eauth_acl_module: alcali
keep_acl_in_token: true

external_auth:
rest:
^url: http://web:8000/api/token/verify/
admin:
- '.*'
- '@runner'
- '@wheel'
- '@jobs'
apiuser:
- test.ping
- minion\*:
Expand All @@ -249,11 +262,13 @@ external_auth:
- state.*
- 'G@os:RedHat':
- kmod.*
alcali:
admin:
- .*
- '.*'
- '@local'
- '@runner'
- '@wheel'
alcali:
- '@jobs'
apiuser:
- test.ping
- minion\*:
Expand All @@ -265,10 +280,6 @@ external_auth:
- state.*
- 'G@os:RedHat':
- kmod.*
admin:
- .*
- '@runner'
- '@wheel'

# Time (in seconds) for a newly generated token to live. Default: 12 hours
#token_expire: 43200
Expand Down Expand Up @@ -691,3 +702,14 @@ rest_cherrypy:
debug: True
ssl_crt: /etc/pki/tls/certs/localhost.crt
ssl_key: /etc/pki/tls/certs/localhost.key

netapi_enable_clients:
- local
- local_async
- local_batch
- local_subset
- runner
- runner_async
- ssh
- wheel
- wheel_async
Loading
Loading