[MultiDB] Add multidb support to sonic-ztp#16
Conversation
|
retest buster please |
src/usr/lib/ztp/ztp-profile.sh
Outdated
| else | ||
| # Remove ZTP configuration from config-db | ||
| redis-cli -n 4 DEL "ZTP|mode" | ||
| sonic-db-cli CONFIG_DB DEL "ZTP|mode" |
There was a problem hiding this comment.
May need to direct to /dev/null to avoid sonic-ztp[xxx]: 1 in syslog
There was a problem hiding this comment.
Thanks. I fixed it.
Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
|
retest this please |
`sonic_installer` has been renamed `sonic-installer`. Update the file name everywhere it is used.
…cal/bin/ (sonic-net#19) Update paths to reflect new sonic-utilities install location. As of PR sonic-net/sonic-utilities#1122, sonic-utilities is built and installed as a Python Wheel package. As such, the installation directory of the scripts/entrypoints has changed from `/usr/bin/` to `/usr/local/bin`. This patch updates all references to the old location to either reference the new location, or remove the absolute path entirely, where applicable.
| self.__input_file = input_file | ||
|
|
||
| self.configDB = ConfigDBConnector() | ||
| if self.configDB is None: |
There was a problem hiding this comment.
self.configDB [](start = 11, length = 13)
Could you clarify when it is None? #Closed
There was a problem hiding this comment.
Fixed in latest commit
There was a problem hiding this comment.
The new code seems worse. Why construct ConfigDBConnector twice?
In reply to: 492363061 [](ancestors = 492363061)
There was a problem hiding this comment.
My bad. I did not resolve the merge conflict properly and ended up having two copies of the code. I fixed it now.
| updateActivity('configdb-json: Removing ZTP configuation from Config DB') | ||
| logger.info('configdb-json: Configuration change detected. Removing ZTP configuation from Config DB.') | ||
| runCommand('redis-cli -n 4 DEL "ZTP|mode"', capture_stdout=False) | ||
| self.configDB.delete_table("ZTP") |
There was a problem hiding this comment.
delete_table [](start = 30, length = 12)
Original code is deleting a entry, and new code is deleting a table. Is it expected? #Closed
There was a problem hiding this comment.
Fixed in latest commit
tests/test_configdb-json.py
Outdated
| cmd = "/bin/sed -i -e 's/\"mac\": \".*\"/\"mac\": \"invalid2\"/' " + str(fh_after) | ||
| rc = runCommand(cmd) | ||
| cmd = "/bin/sed -i -e 's/\"hwsku\": \".*\"/\"hwsku\": \"invalid3\"/' " + str(fh_after) | ||
| rc = runCommand(cmd) |
There was a problem hiding this comment.
Could you just parse config-before.json, modify in memory and write to config-after.json? #Closed
There was a problem hiding this comment.
Fixed in latest commit
tests/test_configdb-json.py
Outdated
| cmd = "/bin/sed -i -e 's/\"mac\": \".*\"/\"mac\": \"invalid2\"/' " + str(fh_after) | ||
| rc = runCommand(cmd) | ||
| cmd = "/bin/sed -i -e 's/\"hwsku\": \".*\"/\"hwsku\": \"" + hwsku + "_dup" +"\"/' " + str(fh_after) | ||
| rc = runCommand(cmd) |
There was a problem hiding this comment.
Fixed in latest commit
src/usr/lib/ztp/ztp-engine.py
Outdated
| def __link_scan(self): | ||
| ## Redis DB connectors | ||
| configDB = None | ||
| applDB = None |
There was a problem hiding this comment.
You mixed using Class Variables and Instance Variables. Please check some tutorial, such as https://careerkarma.com/blog/python-class-variables/ #Closed
There was a problem hiding this comment.
Fixed in latest commit
Signed-off-by: Rajendra Dendukuri <rajendra.dendukuri@broadcom.com>
…dukuri/sonic-ztp into multidb_ztp_cleanup
|
@dzhangalibaba Could you also help review this PR? |
qiluo-msft
left a comment
There was a problem hiding this comment.
LGTM. Please also resolve other reviewers' comments.
src/usr/lib/ztp/ztp-engine.py
Outdated
| # Connect to AppDB | ||
| try: | ||
| if self.applDB is None: | ||
| self.applDB = SonicV2Connector(host='127.0.0.1') |
There was a problem hiding this comment.
remove "host='127.0.0.1' " , it is not needed , all info should come from database_config.json and the host here didn't take effect.
There was a problem hiding this comment.
Implemented the recommended change.
No description provided.