Skip to content

[sonic-package-manager] first phase implementation of sonic-package-manager #6076

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

Closed
wants to merge 96 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
2e01350
[sonic-package-manager] first phase implementation of sonic-package-m…
stepanblyschak Nov 3, 2020
86a1a44
[sonic-package-manager] build sonic-package-manager and install on SONiC
stepanblyschak Nov 3, 2020
541ccc0
[sonic-package-manager] if in chroot or database is not running do no…
stepanblyschak Nov 3, 2020
47bb9bf
fix s2s upgrade
stepanblyschak Nov 3, 2020
25c0e8f
fix problem that list required root
stepanblyschak Nov 3, 2020
aead06c
code cleanup
stepanblyschak Nov 3, 2020
9aa95d6
allow "manifest" command to accept a reference expression
stepanblyschak Nov 3, 2020
8ac0d84
remove commented code
stepanblyschak Nov 3, 2020
ba3991d
update PackageManager with docstrings
stepanblyschak Nov 3, 2020
62e23ba
fix s2s migration: return None instead of False
stepanblyschak Nov 4, 2020
79d9013
add few migration unit tests
stepanblyschak Nov 4, 2020
cf9d8a9
[sonic-package-manager] install CLI plugins
stepanblyschak Nov 4, 2020
10a84b1
[sonic-package-manager] support changelog
stepanblyschak Nov 4, 2020
dec2490
fix unmarshaling bug
stepanblyschak Nov 5, 2020
ebc4845
fix build-in uninstall, upgrade bug
stepanblyschak Nov 6, 2020
31e6383
add debug log for template rendering
stepanblyschak Nov 6, 2020
7499fdf
add missing newlines
stepanblyschak Nov 6, 2020
0fb254d
add docstrings to registry.py
stepanblyschak Nov 6, 2020
887d730
add docstrings to creator.py
stepanblyschak Nov 6, 2020
296127d
change dependency from SWSSSDK_PY2 to SWSSSDK_PY3
stepanblyschak Nov 16, 2020
f3e3ea8
put a comment about swsssdk dependency
stepanblyschak Nov 16, 2020
596267b
generate a header for monit.conf template
stepanblyschak Nov 16, 2020
7797b99
remove PEER and simplify service_mgmt.sh.j2
stepanblyschak Nov 16, 2020
89e0e3f
remove default Before=ntp-config.service
stepanblyschak Nov 16, 2020
d731b30
[database] internal review comments fixes
stepanblyschak Nov 16, 2020
aa178e9
[dockerapi.py] fixes per internal review
stepanblyschak Nov 16, 2020
d2dc252
[logger] dont pring "info" prefix for info logs
stepanblyschak Nov 16, 2020
d048d73
[progress] fixes per internal review
stepanblyschak Nov 16, 2020
2df144d
[reference] add missing newline at the end of file
stepanblyschak Nov 16, 2020
d21e009
[registry] fixes per internal review
stepanblyschak Nov 16, 2020
73630b6
[constraint.py] fix parse docstring examples
stepanblyschak Nov 19, 2020
c074d12
[main.py] fixes per internal review
stepanblyschak Nov 19, 2020
7d144ea
fixes per internal review
stepanblyschak Nov 19, 2020
a8c7f4a
[manager.py] reformat file
stepanblyschak Nov 19, 2020
5239e7b
[manager] fixes per internal review
stepanblyschak Nov 24, 2020
14cb42b
[service_creator] add support to create timer unit
stepanblyschak Nov 24, 2020
31c1703
[service_creator] support for dependent and dependent-of fields
stepanblyschak Nov 24, 2020
717e5c6
[service_mgmt.sh.j2] add support for container lifetime hooks
stepanblyschak Nov 24, 2020
aef834d
[service_creator] add unit tests for ServiceCreator
stepanblyschak Nov 24, 2020
70e0244
convert line endings to unix style
stepanblyschak Nov 24, 2020
dfd5a1f
[service_creator] fix feature registration for delayed services
stepanblyschak Nov 24, 2020
f780162
[service_creator] add support for debug-dump command
stepanblyschak Nov 24, 2020
f15ec7b
convert semver to docker tag
stepanblyschak Nov 27, 2020
5854762
[setup.py] update test req with pyfakefs
stepanblyschak Dec 1, 2020
2ff5335
internal review comments fixes
stepanblyschak Dec 7, 2020
921a652
Merge branch 'master' of github.com:azure/sonic-buildimage into spm
stepanblyschak Dec 9, 2020
f97fb78
Fix LGTM warnings
stepanblyschak Dec 9, 2020
6d9ad49
use pkgutil to get plugins directory path
stepanblyschak Dec 9, 2020
c250706
fix to use prettyprinter package
stepanblyschak Dec 10, 2020
6fc514e
fix base os compat version key string
stepanblyschak Dec 10, 2020
c1ba5a9
make name in manifest mandatory
stepanblyschak Dec 10, 2020
3918474
[database.py] return a copy of PackageEntry
stepanblyschak Dec 11, 2020
013dbe5
[debug-dump] add a TODO for multi-asic
stepanblyschak Dec 11, 2020
e3aaaec
don't resolve CLI package path if cli plugins are not defined
stepanblyschak Dec 14, 2020
8666959
align cli according to HLD
stepanblyschak Dec 14, 2020
c639d5f
[init-cfg] set initial config of package
stepanblyschak Dec 15, 2020
dca3ab5
fix LGTM warning
stepanblyschak Dec 15, 2020
6c64157
[manifest] fix manifest output bugs
stepanblyschak Dec 17, 2020
23a88af
[service_mgmt.sh.j2] fix service name
stepanblyschak Dec 17, 2020
bf8401e
[feature] set service name, not package name
stepanblyschak Dec 17, 2020
6a63a8f
fix bug: use service name, not package name
stepanblyschak Dec 18, 2020
65ef1c1
[registry] support private registries that require authentication
stepanblyschak Dec 28, 2020
68a1fe7
[manifest_resolver] improve manifest errors handling
stepanblyschak Dec 28, 2020
e866dda
[service_creator] fix typo: "serivce" -> "service"
stepanblyschak Dec 29, 2020
622aabe
add ability to install from local tarball image file and fix the issu…
stepanblyschak Jan 12, 2021
1b2095f
[templates] remove -i from docker exec command
stepanblyschak Jan 12, 2021
768e4c4
[manager] fix removing containers with old image
stepanblyschak Jan 12, 2021
ef0a93d
[manager] list all when removing stale containers
stepanblyschak Jan 12, 2021
136fb20
[manager] fix local file installation when no entry present in database
stepanblyschak Jan 15, 2021
2a34674
[manager] optimize package migration.
stepanblyschak Jan 15, 2021
1962306
[manager] use file lock to protect from two processes making system l…
stepanblyschak Jan 15, 2021
9e8a7cd
[manager] do not override repository when installing/upgrading from l…
stepanblyschak Jan 17, 2021
be19c2f
[install] add --default-owner and --enable options
stepanblyschak Jan 18, 2021
89df522
[manager] do not hide original error in rollback
stepanblyschak Jan 18, 2021
5034a13
[manager] put a TODO on systemctl
stepanblyschak Jan 18, 2021
1465515
[manager] fix enabled state
stepanblyschak Jan 18, 2021
61a24b2
[service_creator] support tmpfs mount
stepanblyschak Jan 18, 2021
c3a5c38
[manifest] enhance manifest marshaling code.
stepanblyschak Jan 20, 2021
7f60f78
[sonic_db] remove swsssdk dependency
stepanblyschak Jan 21, 2021
8c69739
[manager] fix review comments
stepanblyschak Jan 22, 2021
8da9346
[dump] support multi-asic container techsupport dump
stepanblyschak Jan 25, 2021
e00f03b
add support for installing package by specifying repository and tag
stepanblyschak Jan 27, 2021
0235fe4
take description from package manifest
stepanblyschak Jan 27, 2021
72e9c68
[tests/test_manager] assert that rollback is actually executed
stepanblyschak Jan 27, 2021
d82e0ac
[tests/test_manager] assert that rollback is actually executed
stepanblyschak Jan 27, 2021
759fbd9
use docker_image_id variable instead of docker_image_name
stepanblyschak Jan 27, 2021
0427468
fix LGTM warningns
stepanblyschak Jan 28, 2021
282d771
fix migration with new api
stepanblyschak Jan 28, 2021
7f66dcf
inherit PackageSource from object to fix LGTM warn
stepanblyschak Jan 28, 2021
889214b
fix bug related to dump generation and fix repository not present if
stepanblyschak Jan 29, 2021
d94577a
[manager] implement component version checks
Mar 18, 2021
ca969b7
fix LGTM alerts
stepanblyschak Mar 22, 2021
aaa373d
[manager] add option to skip CLI installation
stepanblyschak Mar 22, 2021
e073593
[metadata] remove unneded constants
stepanblyschak Mar 22, 2021
233ab83
temp
stepanblyschak Mar 22, 2021
a280970
[manager] base os per component version check
stepanblyschak Mar 22, 2021
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
10 changes: 10 additions & 0 deletions files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@ sudo rm -rf $FILESYSTEM_ROOT/$SONIC_UTILITIES_PY3_WHEEL_NAME
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-utilities-data_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f

# Install SONiC Package Manager Python 3 package
SONIC_PACKAGE_MANAGER_PY3_WHEEL_NAME=$(basename {{sonic_package_manager_py3_wheel_path}})
sudo cp {{sonic_package_manager_py3_wheel_path}} $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_PY3_WHEEL_NAME
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $SONIC_PACKAGE_MANAGER_PY3_WHEEL_NAME
sudo rm -rf $FILESYSTEM_ROOT/$SONIC_PACKAGE_MANAGER_PY3_WHEEL_NAME

# Install sonic-package-manager data files (and any dependencies via 'apt-get -y install -f')
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-package-manager-data_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f

# sonic-utilities-data installs bash-completion as a dependency. However, it is disabled by default
# in bash.bashrc, so we copy a version of the file with it enabled here.
sudo cp -f $IMAGE_CONFIGS/bash/bash.bashrc $FILESYSTEM_ROOT/etc/
Expand Down
9 changes: 9 additions & 0 deletions rules/sonic-package-manager-data.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SPATH := $($(SONIC_PACKAGE_MANAGER_DATA)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-package-manager-data.mk rules/sonic-package-manager-data.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(SPATH))

$(SONIC_PACKAGE_MANAGER_DATA)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_PACKAGE_MANAGER_DATA)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_PACKAGE_MANAGER_DATA)_DEP_FILES := $(DEP_FILES)

6 changes: 6 additions & 0 deletions rules/sonic-package-manager-data.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SONiC command line utilities data package

SONIC_PACKAGE_MANAGER_DATA = sonic-package-manager-data_1.0-1_all.deb
$(SONIC_PACKAGE_MANAGER_DATA)_SRC_PATH = $(SRC_PATH)/sonic-package-manager/sonic-package-manager-data
SONIC_DPKG_DEBS += $(SONIC_PACKAGE_MANAGER_DATA)

11 changes: 11 additions & 0 deletions rules/sonic-package-manager.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SPATH := $($(SONIC_PACKAGE_MANAGER_PY3)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/sonic-package-manager.mk rules/sonic-package-manager.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))

$(SONIC_PACKAGE_MANAGER_PY3)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_PACKAGE_MANAGER_PY3)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_PACKAGE_MANAGER_PY3)_DEP_FILES := $(DEP_FILES)
$(SONIC_PACKAGE_MANAGER_PY3)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC_PACKAGE_MANAGER_PY3)_SMDEP_PATHS := $(SPATH)

10 changes: 10 additions & 0 deletions rules/sonic-package-manager.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# sonic package manager python package

SONIC_PACKAGE_MANAGER_PY3 = sonic_package_manager-1.0-py3-none-any.whl
$(SONIC_PACKAGE_MANAGER_PY3)_SRC_PATH = $(SRC_PATH)/sonic-package-manager/
$(SONIC_PACKAGE_MANAGER_PY3)_PYTHON_VERSION = 3
$(SONIC_PACKAGE_MANAGER_PY3)_DEPENDS += $(SONIC_PY_COMMON_PY3) \
$(SWSSSDK_PY3) # Temporary dependency till issue with py-swsscommon is resolved
$(SONIC_PACKAGE_MANAGER_PY3)_DEBS_DEPENDS += $(PYTHON3_SWSSCOMMON)
SONIC_PYTHON_WHEELS += $(SONIC_PACKAGE_MANAGER_PY3)

5 changes: 4 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(PYTHON_SWSSCOMMON) \
$(PYTHON3_SWSSCOMMON) \
$(SONIC_UTILITIES_DATA) \
$(SONIC_PACKAGE_MANAGER_DATA) \
$(SONIC_HOST_SERVICES_DATA)) \
$$(addprefix $(TARGET_PATH)/,$$($$*_DOCKERS)) \
$$(addprefix $(FILES_PATH)/,$$($$*_FILES)) \
Expand All @@ -840,7 +841,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_YANG_MGMT_PY2)) \
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_YANG_MGMT_PY3)) \
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SYSTEM_HEALTH)) \
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_HOST_SERVICES_PY3))
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_HOST_SERVICES_PY3)) \
$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PACKAGE_MANAGER_PY3))
$(HEADER)
# Pass initramfs and linux kernel explicitly. They are used for all platforms
export debs_path="$(IMAGE_DISTRO_DEBS_PATH)"
Expand Down Expand Up @@ -888,6 +890,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export python_swss_debs="$(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$($(LIBSWSSCOMMON)_RDEPENDS))"
export python_swss_debs+=" $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(LIBSWSSCOMMON)) $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(PYTHON_SWSSCOMMON)) $(addprefix $(IMAGE_DISTRO_DEBS_PATH)/,$(PYTHON3_SWSSCOMMON))"
export sonic_utilities_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_UTILITIES_PY3))"
export sonic_package_manager_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PACKAGE_MANAGER_PY3))"
export sonic_host_services_py3_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_HOST_SERVICES_PY3))"

$(foreach docker, $($*_DOCKERS),\
Expand Down
142 changes: 142 additions & 0 deletions src/sonic-package-manager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# IDEs
.idea/
.vscode/
2 changes: 2 additions & 0 deletions src/sonic-package-manager/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
addopts = --cov=sonic_package_manager --cov-report html --cov-report term --cov-report xml
2 changes: 2 additions & 0 deletions src/sonic-package-manager/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[aliases]
test=pytest
60 changes: 60 additions & 0 deletions src/sonic-package-manager/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from setuptools import setup

setup(
name='sonic-package-manager',
version='1.0',
description='SONiC Package Manager',
author='Stepan Blyshchak',
author_email='[email protected]',
url='https://github.com/Azure/sonic-buildimage',
packages=[
'sonic_package_manager',
'sonic_package_manager/service_creator'
],
install_requires = [
'jinja2>=2.10',
'tabulate',
'poetry-semver',
'click',
'click_log',
'docker',
'docker-image-py',
'enlighten',
'natsort',
'prettyprinter',
'sonic-py-common',
'requests',
'www_authenticate',
'filelock',
],
setup_requires=[
'pytest-runner',
'wheel',
],
tests_require=[
'pytest',
'mock>=2.0.0',
'pytest-sugar',
'pytest-cov',
'pyfakefs',
],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
classifiers=[
'Intended Audience :: Developers',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
entry_points={
'console_scripts': [
'sonic-package-manager = sonic_package_manager.main:cli',
'spm = sonic_package_manager.main:cli',
]
},
test_suite='setup.get_test_suite',
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_sonic_package_manager_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_SONIC_PACKAGE_MANAGER_COMPLETE=complete $1 ) )
return 0
}

complete -F _sonic_package_manager_completion -o default sonic-package-manager;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_sonic_package_manager_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_SONIC_PACKAGE_MANAGER_COMPLETE=complete $1 ) )
return 0
}

complete -F _sonic_package_manager_completion -o default spm;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sonic-package-manager-data (1.0-1) UNRELEASED; urgency=low

* Initial release

-- Stepan Blyshchak <[email protected]> Thu, 1 Oct 2020 00:30:00 +0000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Source: sonic-package-manager-data
Maintainer: Stepan Blyshchak <[email protected]>
Section: misc
Priority: optional
Standards-Version: 0.1
Build-Depends: debhelper (>=9)

Package: sonic-package-manager-data
Architecture: all
Depends: ${misc:Depends} bash-completion
Description: Data files required for SONiC Package Manager
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bash_completion.d/ /etc/
templates/*.j2 /usr/share/sonic/templates/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/make -f

build:

%:
dh $@
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

#
# =============== Managed by SONiC Package Manager. DO NOT EDIT! ===============
# auto-generated from {{ source }} by sonic-package-manager
#

service="{{ manifest.service.name }}"
dump_command="{{ manifest.package['debug-dump'] }}"
container_re="^${service}[0-9]*$"
{% raw %}
container_ids="$(docker ps -f name=${container_re} -f status=running --format {{.Names}})"
{% endraw %}
tmp_dir=$(mktemp -d)
tmp_dump_dir="$tmp_dir/$service"
tmp_archive=$(mktemp)

mkdir -p "$tmp_dump_dir"

for container_id in $container_ids; do
docker exec -t "${container_id}" ${dump_command} &> "${tmp_dump_dir}/${container_id}"
done


tar -C $(dirname $tmp_dump_dir) -cf $tmp_archive $service

cat $tmp_archive
rm $tmp_archive
rm -rf $tmp_dir
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
###############################################################################
##
## =============== Managed by SONiC Package Manager. DO NOT EDIT! ===============
## auto-generated from {{ source }} by sonic-package-manager
##
## Monit configuration for {{ feature }} service
## process list:
{%- for process in processes %}
{%- if process.critical %}
## {{ process.name }}
{%- endif %}
{%- endfor %}
###############################################################################
{%- for process in processes %}
check program {{ feature }}|{{ process.name }} with path "/usr/bin/process_checker {{ feature }} {{ process.command }}"
if status != 0 for 5 times within 5 cycles then alert

{% endfor %}
Loading