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
|
no_prunable = True
|
||||||
for t_list in grouped_tag_lists:
|
for t_list in grouped_tag_lists:
|
||||||
try:
|
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)
|
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
|
continue
|
||||||
else:
|
else:
|
||||||
no_prunable = False
|
no_prunable = False
|
||||||
for tag in t_list[2:]:
|
for group in grouped_t_list[2:]:
|
||||||
if not quiet: print(f'Removing image {tag}')
|
for tag in group:
|
||||||
client.images.remove(tag)
|
if not quiet: print(f'Removing image {tag}')
|
||||||
|
client.images.remove(tag)
|
||||||
except InvalidVersion as e:
|
except InvalidVersion as e:
|
||||||
print(f'so-{get_so_image_basename(t_list[0])}: {e.args[0]}', file=sys.stderr)
|
print(f'so-{get_so_image_basename(t_list[0])}: {e.args[0]}', file=sys.stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
@@ -3,24 +3,19 @@
|
|||||||
|
|
||||||
{% if grains.os == 'Ubuntu' %}
|
{% if grains.os == 'Ubuntu' %}
|
||||||
{% set SPLITCHAR = '+' %}
|
{% set SPLITCHAR = '+' %}
|
||||||
|
{% set SALTNOTHELD = salt['cmd.run']('apt-mark showhold | grep salt-* ; echo $?', python_shell=True) %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set SPLITCHAR = '-' %}
|
{% set SPLITCHAR = '-' %}
|
||||||
|
{% set SALTNOTHELD = salt['cmd.run']('yum versionlock list | grep salt-* ; echo $?', python_shell=True) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set INSTALLEDSALTVERSION = salt['pkg.version']('salt-minion').split(SPLITCHAR)[0] %}
|
{% 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.saltversion|string != SALTVERSION|string %}
|
||||||
{% if grains.os|lower in ['centos', 'redhat'] %}
|
{% 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' %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set UPGRADECOMMAND = 'echo Already running Salt Minion version ' ~ SALTVERSION %}
|
{% 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 %}
|
{% from 'allowed_states.map.jinja' import allowed_states %}
|
||||||
{% if sls in allowed_states %}
|
{% if sls in allowed_states %}
|
||||||
|
|
||||||
{% from 'salt/map.jinja' import COMMON with context %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- salt.minion
|
- salt.minion
|
||||||
|
|
||||||
salt_master_package:
|
{% if SALTNOTHELD == 1 %}
|
||||||
pkg.installed:
|
hold_salt_master_package:
|
||||||
- pkgs:
|
module.run:
|
||||||
- {{ COMMON }}
|
- pkg.hold:
|
||||||
- salt-master
|
- name: salt-master
|
||||||
- hold: True
|
{% endif %}
|
||||||
|
|
||||||
salt_master_service:
|
salt_master_service:
|
||||||
service.running:
|
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 UPGRADECOMMAND with context %}
|
||||||
{% from 'salt/map.jinja' import SALTVERSION %}
|
{% from 'salt/map.jinja' import SALTVERSION %}
|
||||||
{% from 'salt/map.jinja' import INSTALLEDSALTVERSION %}
|
{% from 'salt/map.jinja' import INSTALLEDSALTVERSION %}
|
||||||
|
{% from 'salt/map.jinja' import SALTNOTHELD %}
|
||||||
{% import_yaml 'salt/minion.defaults.yaml' as SALTMINION %}
|
{% import_yaml 'salt/minion.defaults.yaml' as SALTMINION %}
|
||||||
{% set service_start_delay = SALTMINION.salt.minion.service_start_delay %}
|
{% set service_start_delay = SALTMINION.salt.minion.service_start_delay %}
|
||||||
|
|
||||||
@@ -9,6 +9,15 @@ include:
|
|||||||
- salt
|
- salt
|
||||||
- systemd.reload
|
- systemd.reload
|
||||||
|
|
||||||
|
{% if INSTALLEDSALTVERSION|string != SALTVERSION|string %}
|
||||||
|
|
||||||
|
{% if SALTNOTHELD == 0 %}
|
||||||
|
unhold_salt_packages:
|
||||||
|
module.run:
|
||||||
|
- pkg.unhold:
|
||||||
|
- name: 'salt-*'
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
install_salt_minion:
|
install_salt_minion:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: |
|
- name: |
|
||||||
@@ -16,15 +25,16 @@ install_salt_minion:
|
|||||||
exec 1>&- # close stdout
|
exec 1>&- # close stdout
|
||||||
exec 2>&- # close stderr
|
exec 2>&- # close stderr
|
||||||
nohup /bin/sh -c '{{ UPGRADECOMMAND }}' &
|
nohup /bin/sh -c '{{ UPGRADECOMMAND }}' &
|
||||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" != "{{SALTVERSION}}"
|
{% endif %}
|
||||||
|
|
||||||
salt_minion_package:
|
{% if INSTALLEDSALTVERSION|string == SALTVERSION|string %}
|
||||||
pkg.installed:
|
|
||||||
- pkgs:
|
{% if SALTNOTHELD == 1 %}
|
||||||
- {{ COMMON }}
|
hold_salt_packages:
|
||||||
- salt-minion
|
module.run:
|
||||||
- hold: True
|
- pkg.hold:
|
||||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
- name: 'salt-*'
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
set_log_levels:
|
set_log_levels:
|
||||||
file.append:
|
file.append:
|
||||||
@@ -46,11 +56,11 @@ salt_minion_service_unit_file:
|
|||||||
- module: systemd_reload
|
- module: systemd_reload
|
||||||
- listen_in:
|
- listen_in:
|
||||||
- service: salt_minion_service
|
- 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:
|
salt_minion_service:
|
||||||
service.running:
|
service.running:
|
||||||
- name: salt-minion
|
- name: salt-minion
|
||||||
- enable: True
|
- enable: True
|
||||||
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
- onlyif: test "{{INSTALLEDSALTVERSION}}" == "{{SALTVERSION}}"
|
||||||
|
|
||||||
Reference in New Issue
Block a user