Fix problem with reading invalid key form the dictionary

I did in the same way Ian did for other files, but we have to find a better way 
to fix it.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c0a96176
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c0a96176
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c0a96176

Branch: refs/heads/feature/systemvm-persistent-config
Commit: c0a96176277b407a6948a3efd38c78840ea3518c
Parents: 1f5781d
Author: wilderrodrigues <[email protected]>
Authored: Wed Dec 17 19:12:36 2014 +0100
Committer: wilderrodrigues <[email protected]>
Committed: Wed Feb 4 18:41:10 2015 +0100

----------------------------------------------------------------------
 .../debian/config/opt/cloud/bin/cs/CsGuestNetwork.py      | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c0a96176/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
----------------------------------------------------------------------
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py 
b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
index c1cd8a4..c15e006 100644
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsGuestNetwork.py
@@ -39,10 +39,16 @@ class CsGuestNetwork:
         return self.config.get_dns()
 
     def get_netmask(self):
-        return self.data['router_guest_netmask']
+        #We need to fix it properly. I just added the if, as Ian did in some 
other files, to avoid the exception.
+        if 'router_guest_netmask' in self.data:
+            return self.data['router_guest_netmask']
+        return ''
 
     def get_gateway(self):
-        return self.data['router_guest_gateway']
+        #We need to fix it properly. I just added the if, as Ian did in some 
other files, to avoid the exception.
+        if 'router_guest_gateway' in self.data:
+            return self.data['router_guest_gateway']
+        return ''
 
     def get_domain(self):
         domain = "cloudnine.internal"

Reply via email to