mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Merge branch 'dev' into foxtrot
This commit is contained in:
@@ -60,15 +60,19 @@ def main(quiet):
|
||||
no_prunable = True
|
||||
for t_list in grouped_tag_lists:
|
||||
try:
|
||||
# Keep the 2 most current images
|
||||
# Group tags by version, in case multiple images exist with the same version string
|
||||
t_list.sort(key=lambda x: Version(get_image_version(x)), reverse=True)
|
||||
if len(t_list) <= 2:
|
||||
grouped_t_list = [ list(it) for _,it in groupby(t_list, lambda x: get_image_version(x)) ]
|
||||
|
||||
# Keep the 2 most current version groups
|
||||
if len(grouped_t_list) <= 2:
|
||||
continue
|
||||
else:
|
||||
no_prunable = False
|
||||
for tag in t_list[2:]:
|
||||
if not quiet: print(f'Removing image {tag}')
|
||||
client.images.remove(tag)
|
||||
for group in grouped_t_list[2:]:
|
||||
for tag in group:
|
||||
if not quiet: print(f'Removing image {tag}')
|
||||
client.images.remove(tag)
|
||||
except InvalidVersion as e:
|
||||
print(f'so-{get_so_image_basename(t_list[0])}: {e.args[0]}', file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
@@ -3,24 +3,19 @@
|
||||
|
||||
{% if grains.os == 'Ubuntu' %}
|
||||
{% set SPLITCHAR = '+' %}
|
||||
{% set SALTNOTHELD = salt['cmd.run']('apt-mark showhold | grep salt-* ; echo $?', python_shell=True) %}
|
||||
{% else %}
|
||||
{% set SPLITCHAR = '-' %}
|
||||
{% set SALTNOTHELD = salt['cmd.run']('yum versionlock list | grep salt-* ; echo $?', python_shell=True) %}
|
||||
{% endif %}
|
||||
|
||||
{% set INSTALLEDSALTVERSION = salt['pkg.version']('salt-minion').split(SPLITCHAR)[0] %}
|
||||
{% set ISAIRGAP = salt['pillar.get']('global:airgap', 'False') %}
|
||||
|
||||
{% if grains.os|lower == 'ubuntu' %}
|
||||
{% set COMMON = 'salt-common' %}
|
||||
{% elif grains.os|lower in ['centos', 'redhat'] %}
|
||||
{% set COMMON = 'salt' %}
|
||||
{% endif %}
|
||||
|
||||
{% if grains.saltversion|string != SALTVERSION|string %}
|
||||
{% if grains.os|lower in ['centos', 'redhat'] %}
|
||||
{% set UPGRADECOMMAND = 'yum clean all ; yum versionlock delete "salt-*" && /usr/sbin/bootstrap-salt.sh -X -s 120 -r -F -x python3 stable ' ~ SALTVERSION ~ ' ; yum versionlock add "salt-*"' %}
|
||||
{% set UPGRADECOMMAND = 'yum clean all ; /usr/sbin/bootstrap-salt.sh -X -s 120 -r -F -x python3 stable ' ~ SALTVERSION ~ ' && yum versionlock add "salt-*"' %}
|
||||
{% elif grains.os|lower == 'ubuntu' %}
|
||||
{% set UPGRADECOMMAND = 'apt-mark unhold salt-common ; apt-mark unhold salt-minion && /usr/sbin/bootstrap-salt.sh -X -s 120 -F -x python3 stable ' ~ SALTVERSION ~ ' ; apt-mark hold salt-common && apt-mark hold salt-minion' %}
|
||||
{% set UPGRADECOMMAND = '/usr/sbin/bootstrap-salt.sh -X -s 120 -F -x python3 stable ' ~ SALTVERSION ~ ' && apt-mark hold salt-common && apt-mark hold salt-minion' %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set UPGRADECOMMAND = 'echo Already running Salt Minion version ' ~ SALTVERSION %}
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
{% from 'salt/map.jinja' import SALTNOTHELD %}
|
||||
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||
{% if sls in allowed_states %}
|
||||
|
||||
{% from 'salt/map.jinja' import COMMON with context %}
|
||||
|
||||
include:
|
||||
- salt.minion
|
||||
|
||||
salt_master_package:
|
||||
pkg.installed:
|
||||
- pkgs:
|
||||
- {{ COMMON }}
|
||||
- salt-master
|
||||
- hold: True
|
||||
{% if SALTNOTHELD == 1 %}
|
||||
hold_salt_master_package:
|
||||
module.run:
|
||||
- pkg.hold:
|
||||
- name: salt-master
|
||||
{% endif %}
|
||||
|
||||
salt_master_service:
|
||||
service.running:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% from 'salt/map.jinja' import COMMON with context %}
|
||||
{% from 'salt/map.jinja' import UPGRADECOMMAND with context %}
|
||||
{% from 'salt/map.jinja' import SALTVERSION %}
|
||||
{% from 'salt/map.jinja' import INSTALLEDSALTVERSION %}
|
||||
{% from 'salt/map.jinja' import SALTNOTHELD %}
|
||||
{% import_yaml 'salt/minion.defaults.yaml' as SALTMINION %}
|
||||
{% set service_start_delay = SALTMINION.salt.minion.service_start_delay %}
|
||||
|
||||
@@ -9,6 +9,15 @@ include:
|
||||
- salt
|
||||
- systemd.reload
|
||||
|
||||
{% if INSTALLEDSALTVERSION|string != SALTVERSION|string %}
|
||||
|
||||
{% if SALTNOTHELD == 0 %}
|
||||
unhold_salt_packages:
|
||||
module.run:
|
||||
- pkg.unhold:
|
||||
- name: 'salt-*'
|
||||
{% endif %}
|
||||
|
||||
install_salt_minion:
|
||||
cmd.run:
|
||||
- name: |
|
||||
@@ -16,15 +25,16 @@ install_salt_minion:
|
||||
exec 1>&- # close stdout
|
||||
exec 2>&- # close stderr
|
||||
nohup /bin/sh -c '{{ UPGRADECOMMAND }}' &
|
||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" != "{{SALTVERSION}}"
|
||||
{% endif %}
|
||||
|
||||
salt_minion_package:
|
||||
pkg.installed:
|
||||
- pkgs:
|
||||
- {{ COMMON }}
|
||||
- salt-minion
|
||||
- hold: True
|
||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
||||
{% if INSTALLEDSALTVERSION|string == SALTVERSION|string %}
|
||||
|
||||
{% if SALTNOTHELD == 1 %}
|
||||
hold_salt_packages:
|
||||
module.run:
|
||||
- pkg.hold:
|
||||
- name: 'salt-*'
|
||||
{% endif %}
|
||||
|
||||
set_log_levels:
|
||||
file.append:
|
||||
@@ -46,11 +56,11 @@ salt_minion_service_unit_file:
|
||||
- module: systemd_reload
|
||||
- listen_in:
|
||||
- service: salt_minion_service
|
||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
||||
{% endif %}
|
||||
|
||||
# this has to be outside the if statement above since there are <requisite>_in calls to this state
|
||||
salt_minion_service:
|
||||
service.running:
|
||||
- name: salt-minion
|
||||
- enable: True
|
||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
||||
|
||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
||||
Reference in New Issue
Block a user