~bigdata-dev/charms/trusty/hdp-accumulo/trunk

« back to all changes in this revision

Viewing changes to hooks/bdutils.py

  • Committer: amir sanjar
  • Date: 2014-09-21 01:58:01 UTC
  • Revision ID: amir.sanjar@canonical.com-20140921015801-y1izcbpyvus287j9
addign relations

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    eValue.text = value
19
19
    propertyE.append(eValue)
20
20
    return propertyE
21
 
    
 
21
 
 
22
def getHadoopConfigXML (xmlfileNamePath, name):
 
23
    print("==> setHadoopConfigXML ","INFO")
 
24
    import xml.etree.ElementTree as ET
 
25
    with open(xmlfileNamePath,'rb+') as f:    
 
26
        root = ET.parse(f).getroot()
 
27
        proList = root.findall("property")
 
28
        for p in proList:
 
29
            cList = p.getchildren()
 
30
            for c in cList:
 
31
                if c.text == name:
 
32
                    return p.find("value").text
 
33
        return None 
 
34
 
22
35
def setHadoopConfigXML (xmlfileNamePath, name, value):
23
36
    import xml.dom.minidom as minidom
24
37
    log("==> setHadoopConfigXML ","INFO")