Commit 836aecf
committed
Python exception processing static routes
static routes that don't reference a private gateway don't have an
ip_address and therefore will throw a key error:
```
root@r-359-VM:/var/cache/cloud# update_config.py ip_associations.json.7407b8bd-21c6-4d99-aae0-f2193412650c
Traceback (most recent call last):
File "/opt/cloud/bin/update_config.py", line 147, in <module>
process_file()
File "/opt/cloud/bin/update_config.py", line 57, in process_file
finish_config()
File "/opt/cloud/bin/update_config.py", line 42, in finish_config
returncode = configure.main(sys.argv)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/cloud/bin/configure.py", line 1647, in main
config.address().process()
File "/opt/cloud/bin/cs/CsAddress.py", line 138, in process
ip.configure(address)
File "/opt/cloud/bin/cs/CsAddress.py", line 348, in configure
self.post_configure(address)
File "/opt/cloud/bin/cs/CsAddress.py", line 370, in post_configure
self.post_config_change("add")
File "/opt/cloud/bin/cs/CsAddress.py", line 824, in post_config_change
self.fw_vpcrouter()
File "/opt/cloud/bin/cs/CsAddress.py", line 606, in fw_vpcrouter
if static_route['ip_address'] == self.address['public_ip'] and not static_route['revoke']:
~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'ip_address'
```
Example static routes:
```
root@r-359-VM:/var/cache/cloud# cat /etc/cloudstack/staticroutes.json
{
"10.10.48.0/20": {
"gateway": "10.252.240.10",
"network": "10.10.48.0/20",
"revoke": false
},
"10.250.0.0/16": {
"gateway": "10.252.240.10",
"network": "10.250.0.0/16",
"revoke": false
},
"id": "staticroutes"
}
```1 parent 2dbc86a commit 836aecf
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
| 606 | + | |
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| |||
0 commit comments