Author: tomaz
Date: Tue Oct 11 18:24:48 2011
New Revision: 1182002
URL: http://svn.apache.org/viewvc?rev=1182002&view=rev
Log:
Fall back to IP tag if ip attribute isn't specified. This patch has been
submitted by Hutson Betts <hut606 at gmail dot com> and is part of LIBCLOUD-117.
Modified:
libcloud/trunk/libcloud/compute/drivers/opennebula.py
Modified: libcloud/trunk/libcloud/compute/drivers/opennebula.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/opennebula.py?rev=1182002&r1=1182001&r2=1182002&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/opennebula.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/opennebula.py Tue Oct 11 18:24:48
2011
@@ -16,7 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
-OpenNebula driver. Compatible with OpenNebula 1.4
+OpenNebula driver.
"""
from base64 import b64encode
@@ -197,7 +197,12 @@ class OpenNebulaNodeDriver(NodeDriver):
networks = []
for element in compute.findall("NIC"):
- networks.append(element.attrib["ip"])
+ ip = element.element.attrib.get('ip', None)
+
+ if ip is None:
+ ip = element.findtext("IP")
+
+ networks.append(ip)
return Node(id=compute.findtext("ID"),
name=compute.findtext("NAME"),