Skip to content

Commit 253b797

Browse files
[sonic-package-manager] do not modify config_db.json (#3032)
What I did Installing an app.ext currently inserts app.ext specific init config into redis CONFIG_DB, /etc/sonic/config_db.json and /etc/sonic/init_cfg.json. Since on configuration reload and boot the configuration file is merged with /etc/sonic/init_cfg.json there is no point in modifying config_db.json. This can cause issues when config_db.json is not up-to-date. This is not a problem to configuration reload due to config migration, but it is not a valid JSON according to YANG model which does not validate old schema. How I did it Removed the relevant part of the code. How to verify it Verified by ONIE installing SONiC and installing an extension. Previosuly it failed and complaining about config_db.json not being valid: Leafref "../../LOOPBACK_INTERFACE_LIST/name" of value "Loopback0" points to a non-existing leaf. This is due to missing "Loopback0": {} in the LOOPBACK_INTERFACE table. This is not a problem since db_migrator can deal with it. With this change, this is fixed - config_db.json is not modified, however app.ext initial configuration is inserted into redis CONFIG_DB after configuration reload or reboot. Signed-off-by: Stepan Blyschak <[email protected]>
1 parent 177dd8e commit 253b797

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

sonic_package_manager/service_creator/sonic_db.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from sonic_package_manager.service_creator.utils import in_chroot
1313

1414
CONFIG_DB = 'CONFIG_DB'
15-
CONFIG_DB_JSON = os.path.join(ETC_SONIC_PATH, 'config_db.json')
1615
INIT_CFG_JSON = os.path.join(ETC_SONIC_PATH, 'init_cfg.json')
1716

1817

@@ -99,12 +98,9 @@ def get_connectors(cls):
9998
""" Yields available DBs connectors. """
10099

101100
initial_db_conn = cls.get_initial_db_connector()
102-
persistent_db_conn = cls.get_persistent_db_connector()
103101
running_db_conn = cls.get_running_db_connector()
104102

105103
yield initial_db_conn
106-
if persistent_db_conn is not None:
107-
yield persistent_db_conn
108104
if running_db_conn is not None:
109105
yield running_db_conn
110106

@@ -127,15 +123,6 @@ def get_running_db_connector(cls):
127123

128124
return cls._running_db_conn
129125

130-
@classmethod
131-
def get_persistent_db_connector(cls):
132-
""" Returns persistent DB connector. """
133-
134-
if not os.path.exists(CONFIG_DB_JSON):
135-
return None
136-
137-
return PersistentConfigDbConnector(CONFIG_DB_JSON)
138-
139126
@classmethod
140127
def get_initial_db_connector(cls):
141128
""" Returns initial DB connector. """

0 commit comments

Comments
 (0)