Skip to content

Commit 00bdadb

Browse files
author
Taras Keryk
committed
Merge branch 'master' of github.com:Azure/sonic-utilities
2 parents 6ba87e4 + 72b9cf9 commit 00bdadb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1110
-248
lines changed

.bandit

Whitespace-only changes.

.github/workflows/bandit.yml

-20
This file was deleted.

azure-pipelines.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ stages:
2626
vmImage: ubuntu-20.04
2727

2828
container:
29-
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-buster:latest
29+
image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye:latest
3030

3131
steps:
3232
- script: |
@@ -58,15 +58,15 @@ stages:
5858
sudo dpkg -i libyang_1.0.73_amd64.deb
5959
sudo dpkg -i libyang-cpp_1.0.73_amd64.deb
6060
sudo dpkg -i python3-yang_1.0.73_amd64.deb
61-
workingDirectory: $(Pipeline.Workspace)/target/debs/buster/
61+
workingDirectory: $(Pipeline.Workspace)/target/debs/bullseye/
6262
displayName: 'Install Debian dependencies'
6363
6464
- task: DownloadPipelineArtifact@2
6565
inputs:
6666
source: specific
6767
project: build
6868
pipeline: 9
69-
artifact: sonic-swss-common
69+
artifact: sonic-swss-common.bullseye.amd64
7070
runVersion: 'latestFromBranch'
7171
runBranch: 'refs/heads/master'
7272
displayName: "Download sonic swss common deb packages"
@@ -86,14 +86,14 @@ stages:
8686
sudo pip3 install sonic_yang_models-1.0-py3-none-any.whl
8787
sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl
8888
sudo pip3 install sonic_platform_common-1.0-py3-none-any.whl
89-
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/buster/
89+
workingDirectory: $(Pipeline.Workspace)/target/python-wheels/bullseye/
9090
displayName: 'Install Python dependencies'
9191
9292
- script: |
9393
set -ex
9494
# Install .NET CORE
9595
curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
96-
sudo apt-add-repository https://packages.microsoft.com/debian/10/prod
96+
sudo apt-add-repository https://packages.microsoft.com/debian/11/prod
9797
sudo apt-get update
9898
sudo apt-get install -y dotnet-sdk-5.0
9999
displayName: "Install .NET CORE"

config/feature.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import click
44
from swsscommon import swsscommon
55
from utilities_common.cli import AbbreviationGroup, pass_db
6+
from .validated_config_db_connector import ValidatedConfigDBConnector
67

78
SELECT_TIMEOUT = 1000 # ms
89

@@ -24,7 +25,12 @@ def set_feature_state(cfgdb_clients, name, state, block):
2425
raise Exception("Feature '{}' state is always enabled and can not be modified".format(name))
2526

2627
for ns, cfgdb in cfgdb_clients.items():
27-
cfgdb.mod_entry('FEATURE', name, {'state': state})
28+
try:
29+
config_db = ValidatedConfigDBConnector(cfgdb)
30+
config_db.mod_entry('FEATURE', name, {'state': state})
31+
except ValueError as e:
32+
ctx = click.get_current_context()
33+
ctx.fail("Invalid ConfigDB. Error: {}".format(e))
2834

2935
if block:
3036
db = swsscommon.DBConnector('STATE_DB', 0)
@@ -66,7 +72,12 @@ def _update_field(db, name, fld, val):
6672
if name not in tbl:
6773
click.echo("Unable to retrieve {} from FEATURE table".format(name))
6874
sys.exit(1)
69-
db.cfgdb.mod_entry('FEATURE', name, { fld: val })
75+
try:
76+
config_db = ValidatedConfigDBConnector(db.cfgdb)
77+
config_db.mod_entry('FEATURE', name, { fld: val })
78+
except ValueError as e:
79+
ctx = click.get_current_context()
80+
ctx.fail("Invalid ConfigDB. Error: {}".format(e))
7081

7182

7283
#
@@ -137,5 +148,10 @@ def feature_autorestart(db, name, autorestart):
137148
return
138149

139150
for ns, cfgdb in db.cfgdb_clients.items():
140-
cfgdb.mod_entry('FEATURE', name, {'auto_restart': autorestart})
151+
try:
152+
config_db = ValidatedConfigDBConnector(cfgdb)
153+
config_db.mod_entry('FEATURE', name, {'auto_restart': autorestart})
154+
except ValueError as e:
155+
ctx = click.get_current_context()
156+
ctx.fail("Invalid ConfigDB. Error: {}".format(e))
141157

0 commit comments

Comments
 (0)