Ignore:
Timestamp:
Mar 26, 2010, 6:42:38 PM (15 years ago)
Author:
tobias
Message:

node replacement added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vanHelsing/trunk/src/VanHelsingWrapper.py

    r839 r855  
    1313    password=""
    1414    for a in xrange(0,len):
    15        password += random.choice(charset)
     15        password += random.choice(charset)
    1616    return password
    1717
     
    8686def getResourceById(directorName,resId):
    8787    dirdcfg=getDirectorConfig(directorName)
    88     return dirdcfg.getRoot().getById(resId)   
     88    return dirdcfg.getRoot().getById(resId)
     89
     90def setResourceById(resId, directorName, attributes, resInfo):
     91    if resId > 0:
     92        myResource = getResourceById(directorName, resId)
     93        myResource.items = []
     94        for a in attributes:
     95            k = a.get_element_key()
     96            v = a.get_element_value()
     97            myResource.add(k, v)
     98
     99    else:
     100        resource = resource.Resource()
     101        resource.name = resInfo.get_element_resName()
     102        setResourceById(resource.getId, directorName, attributes, resInfo)
     103       
     104    status = "wtf"
     105   
     106    return resId, status
    89107
    90108def getResourceByName(directorName,resType,name):
     
    103121    clientIds=getResources("bacula-dir","Client")
    104122       
    105     c=getResourceById("bacula-dir",clientIds[0][0])
    106     print c
    107     print keyValueList(c)
    108 
     123    #c=getResourceById("bacula-dir",clientIds[0][0])
     124    #print c
     125    #print keyValueList(c)
     126    attList = [("name", "klaus"), ("director", "bernd"), ("FileSet","homeAll")]
     127    resId, status = setResourceById(100, "bacula-dir", attList)
Note: See TracChangeset for help on using the changeset viewer.