forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit ac8382f
authored
[generic-config-updater] Logging change just before applying it (sonic-net#1934)
#### What I did
Logging a json change just before applying it. This help knowing at which step we failed change application.
#### How I did it
Added new log msg
#### Previous command output (if the output of a command-line utility has changed)
```sh
admin@vlab-01:~$ sudo config apply-patch empty-a-table.json-patch
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"op": "replace", "path": "/DEVICE_METADATA", "value": {}}]
Patch Applier: Validating patch is not making changes to tables without YANG models.
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Patch Applier: Validating target config according to YANG models.
... [sonic-yang-mgmt logs]
Patch Applier: Sorting patch updates.
... [sonic-yang-mgmt logs]
Patch Applier: The patch was sorted into 11 changes:
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/bgp_asn"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/buffer_model"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_bgp_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_pfcwd_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/deployment_id"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/docker_routing_config_mode"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hostname"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hwsku"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/mac"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/platform"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost"}]
Patch Applier: Applying changes in order.
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: After applying patch to config, there are still some parts not updated
admin@vlab-01:~$
```
#### New command output (if the output of a command-line utility has changed)
```sh
admin@vlab-01:~$ sudo config apply-patch empty-a-table.json-patch
Patch Applier: Patch application starting.
Patch Applier: Patch: [{"op": "replace", "path": "/DEVICE_METADATA", "value": {}}]
Patch Applier: Validating patch is not making changes to tables without YANG models.
Patch Applier: Getting current config db.
Patch Applier: Simulating the target full config after applying the patch.
Patch Applier: Validating target config according to YANG models.
... [sonic-yang-mgmt logs]
Patch Applier: Sorting patch updates.
... [sonic-yang-mgmt logs]
Patch Applier: The patch was sorted into 11 changes:
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/bgp_asn"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/buffer_model"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_bgp_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_pfcwd_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/deployment_id"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/docker_routing_config_mode"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hostname"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hwsku"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/mac"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/platform"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost"}]
Patch Applier: Applying 11 changes in order:
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/bgp_asn"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/buffer_model"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_bgp_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/default_pfcwd_status"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/deployment_id"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/docker_routing_config_mode"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hostname"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/hwsku"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/mac"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost/platform"}]
Patch Applier: * [{"op": "remove", "path": "/DEVICE_METADATA/localhost"}]
Patch Applier: Verifying patch updates are reflected on ConfigDB.
Failed to apply patch
Usage: config apply-patch [OPTIONS] PATCH_FILE_PATH
Try "config apply-patch -h" for help.
Error: After applying patch to config, there are still some parts not updated
admin@vlab-01:~$
```1 parent 9ab6c51 commit ac8382fCopy full SHA for ac8382f
1 file changed
+3
-1
lines changedgeneric_config_updater/generic_updater.py
Copy file name to clipboardExpand all lines: generic_config_updater/generic_updater.py+3-1
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
| 80 | + | |
| 81 | + | |
81 | 82 |
| |
| 83 | + | |
82 | 84 |
| |
83 | 85 |
| |
84 | 86 |
| |
|
0 commit comments