Changeset 824
- Timestamp:
- Feb 17, 2010, 5:49:19 PM (15 years ago)
- Location:
- vanHelsing/trunk/src
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vanHelsing/trunk/src/VanHelsing.wsdl
r823 r824 3 3 <wsdl:types> 4 4 <xsd:schema targetNamespace="http://www.dass-it.de/VanHelsing/"> 5 <xsd:element name=" ResourceName" type="tns:ResourceNameType">5 <xsd:element name="listResources" type="tns:listResourcesType"> 6 6 </xsd:element> 7 <xsd:element name="ResourceResponse" 8 type="tns:Resource"> 7 <xsd:element name="listResourcesResponse" type="tns:resourceListType"> 9 8 </xsd:element> 10 11 <xsd:complexType name="Resource"> 12 9 <xsd:complexType name="listResourcesType"> 13 10 <xsd:sequence> 14 <xsd:element name="attributes" type="tns:Attribute"></xsd:element> 11 <xsd:element name="resourceType" type="xsd:string"></xsd:element> 12 <xsd:element name="director" type="xsd:string"></xsd:element> 15 13 </xsd:sequence> 16 <xsd:attribute name="id" type="xsd:int"></xsd:attribute>17 <xsd:attribute name="type" type="xsd:string"></xsd:attribute>18 <xsd:attribute name="name" type="xsd:string"></xsd:attribute>19 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>20 14 </xsd:complexType> 21 22 <xsd:complexType name="Attribute">23 <xsd:attribute name="key" type="xsd:string"></xsd:attribute>24 < xsd:attribute name="value" type="xsd:string"></xsd:attribute>15 <xsd:complexType name="resourceListType"> 16 <xsd:sequence> 17 <xsd:element name="resourceList" type="tns:ResourceInfo" maxOccurs="unbounded" minOccurs="0"></xsd:element> 18 </xsd:sequence> 25 19 </xsd:complexType> 26 <xsd:element name="in" type="xsd:string"></xsd:element>27 <xsd:element name="getResourceByIdResponse">28 <xsd:complexType>29 <xsd:sequence>30 <xsd:element name="out" type="xsd:string"></xsd:element>31 </xsd:sequence>32 </xsd:complexType>33 </xsd:element>34 <xsd:complexType name="ResourceIdType">35 <xsd:attribute name="id" type="xsd:int"></xsd:attribute>36 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>37 </xsd:complexType>38 <xsd:element name="ResourceId" type="tns:ResourceIdType"></xsd:element>39 <xsd:complexType name="ResourceNameType">40 <xsd:attribute name="type" type="xsd:string"></xsd:attribute>41 <xsd:attribute name="name" type="xsd:string"></xsd:attribute>42 <xsd:attribute name="director" type="xsd:string"></xsd:attribute>43 </xsd:complexType>44 20 45 <xsd:complexType name="ResourceInfo"> 46 <xsd:attribute name="id" type="xsd:int"></xsd:attribute> 47 <xsd:attribute name="type" type="xsd:string"></xsd:attribute> 48 <xsd:attribute name="name" type="xsd:string"></xsd:attribute> 49 <xsd:attribute name="director" type="xsd:string"></xsd:attribute> 50 </xsd:complexType> 51 52 <xsd:attribute name="NewAttribute" type="xsd:string"></xsd:attribute> 53 54 55 56 <xsd:element name="in1" type="xsd:string"></xsd:element> 57 <xsd:element name="getResourcesByTypeResponse"> 58 <xsd:complexType> 59 <xsd:sequence> 60 <xsd:element name="out" type="xsd:string"></xsd:element> 61 </xsd:sequence> 62 </xsd:complexType> 63 </xsd:element> 64 <xsd:element name="ResourceType" type="tns:ResourceType"></xsd:element> 65 66 <xsd:complexType name="ResourceType"> 67 <xsd:attribute name="type" type="xsd:string"></xsd:attribute> 68 <xsd:attribute name="director" type="xsd:string"></xsd:attribute> 69 </xsd:complexType> 70 <xsd:element name="ResourceListResponse" 71 type="tns:ResourceList"> 72 </xsd:element> 73 74 <xsd:complexType name="ResourceList"> 75 <xsd:sequence maxOccurs="unbounded" minOccurs="0"> 76 <xsd:element name="resources" type="tns:ResourceInfo"></xsd:element> 77 </xsd:sequence> 78 </xsd:complexType> 21 <xsd:complexType name="ResourceInfo"> 22 <xsd:sequence> 23 <xsd:element name="resId" type="xsd:int"></xsd:element> 24 <xsd:element name="resType" type="xsd:string"></xsd:element> 25 <xsd:element name="resName" type="xsd:string"></xsd:element> 26 <xsd:element name="director" type="xsd:string"></xsd:element> 27 </xsd:sequence> 28 </xsd:complexType> 79 29 </xsd:schema> 80 30 </wsdl:types> 81 <wsdl:message name="getResourceByNameRequest">82 <wsdl:part element="tns:ResourceName" name="resourceName" />83 </wsdl:message>84 <wsdl:message name="getResourceByNameResponse">85 <wsdl:part name="resourceResult" element="tns:ResourceResponse"/>86 </wsdl:message>87 <wsdl:message name="getResourceByIdRequest">88 <wsdl:part name="resourceId" element="tns:ResourceId"></wsdl:part>89 </wsdl:message>90 <wsdl:message name="getResourceByIdResponse">91 <wsdl:part name="resourceResult" element="tns:ResourceResponse"></wsdl:part>92 </wsdl:message>93 31 <wsdl:message name="listResourcesRequest"> 94 <wsdl:part name="resourceType" element="tns:ResourceType"></wsdl:part>32 <wsdl:part name="resourceType" element="tns:listResources"/> 95 33 </wsdl:message> 96 34 <wsdl:message name="listResourcesResponse"> 97 <wsdl:part name="resourcesResult" element="tns:ResourceListResponse"></wsdl:part>35 <wsdl:part element="tns:listResourcesResponse" name="resultList"/> 98 36 </wsdl:message> 99 37 <wsdl:portType name="VanHelsing"> 100 <wsdl:operation name="getResourceByName">101 <wsdl:input message="tns:getResourceByNameRequest"/>102 <wsdl:output message="tns:getResourceByNameResponse"/>103 </wsdl:operation>104 <wsdl:operation name="getResourceById">105 <wsdl:input message="tns:getResourceByIdRequest"></wsdl:input>106 <wsdl:output message="tns:getResourceByIdResponse"></wsdl:output>107 </wsdl:operation>108 38 <wsdl:operation name="listResources"> 109 <wsdl:input message="tns:listResourcesRequest"></wsdl:input>110 <wsdl:output message="tns:listResourcesResponse"></wsdl:output>39 <wsdl:input message="tns:listResourcesRequest"/> 40 <wsdl:output message="tns:listResourcesResponse"/> 111 41 </wsdl:operation> 112 42 </wsdl:portType> 113 43 <wsdl:binding name="VanHelsingSOAP" type="tns:VanHelsing"> 114 44 <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 115 <wsdl:operation name=" getResourceByName">45 <wsdl:operation name="listResources"> 116 46 <soap:operation soapAction="http://www.dass-it.de/VanHelsing/NewOperation"/> 117 47 <wsdl:input> … … 125 55 <wsdl:service name="VanHelsing"> 126 56 <wsdl:port binding="tns:VanHelsingSOAP" name="VanHelsingSOAP"> 127 <soap:address location="http:// www.dass-it.de/VanHelsing"/>57 <soap:address location="http://localhost:8080/"/> 128 58 </wsdl:port> 129 59 </wsdl:service> -
vanHelsing/trunk/src/bcfg.py
r823 r824 8 8 import resource 9 9 import directive 10 import random 10 11 11 12 12 RESOURCE_TYPES = ('dird', 'console', 'filed', 'stored') … … 157 157 pass 158 158 159 def genpasswd(len=32):160 charset="01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!/%()=?@"161 password=""162 for a in xrange(0,len):163 password += random.choice(charset)164 return password165 166 167 def createClientConfig(dirdcfg,clientName,clientPassword=genpasswd()):168 director=dirdcfg.getRoot().getByType("Director")[0]169 dirdName=director.getName()170 r=dirdcfg.getRoot().getByName(clientName)171 if len(r)==1:172 client=r[0]173 else:174 return175 176 filename=clientName+".conf"177 fdcfg=FiledConfig(filename)178 fdcfg.setDefaults(dirdName,clientPassword,clientName)179 fdcfg.write()180 181 def createAllClientConfigs(dirdcfg):182 clients=dirdcfg.getRoot().getByType("Client",1)183 director=dirdcfg.getRoot().getByType("Director")[0]184 dirdName=director.getName()185 186 for c in clients:187 print c188 clientName=c.getName()189 if clientName!=None:190 r=c.getByType("Password")191 if len(r)>0:192 clientPassword=r[0].value193 clientPassword=clientPassword.replace('"','')194 else:195 clientPassword=""196 filename=clientName+".conf"197 fdcfg=FiledConfig(filename)198 fdcfg.setDefaults(dirdName,clientPassword,clientName)199 fdcfg.write()200 201 def getDirectors():202 return [ "bacula-dir" ];203 204 def loadDirectorConfig(filename):205 global currentConfig206 currentConfig=DirdConfig(filename)207 currentConfig.read()208 209 def getDirectorConfig(directorName):210 global currentConfig211 return currentConfig212 213 def getClients(directorName):214 return getResources(directorName,"Client")215 216 def getResources(directorName,resType):217 dirdcfg=getDirectorConfig(directorName)218 resources=dirdcfg.getRoot().getByType(resType,1)219 result=[]220 for r in resources:221 result.append((r.id,r.getName()))222 return result223 224 def getResourceById(directorName,resId):225 dirdcfg=getDirectorConfig(directorName)226 return dirdcfg.getRoot().getById(resId)227 228 def getResourceByName(directorName,resType,name):229 dirdcfg=getDirectorConfig(directorName)230 return dirdcfg.getRoot().getByName(name,resType)[0]231 232 233 159 if __name__ == "__main__": 234 160 if len(sys.argv) < 2:
Note:
See TracChangeset
for help on using the changeset viewer.