def __init__(self,delegate): self.__dict__["_ci"] = delegate # Create control task methods (if proxies exposed) try: descriptor = DescriptorRegistry.getDescriptor(delegate.type) controlTasks = descriptor.controlTasks for task in controlTasks: self.__dict__[task.name] = lambda: deployit.executeControlTask(task.name, self._ci) except: pass
def __init__(self, delegate): self.__dict__["_ci"] = delegate # Create control task methods (if proxies exposed) try: descriptor = DescriptorRegistry.getDescriptor(delegate.type) controlTasks = descriptor.controlTasks for task in controlTasks: self.__dict__[task.name] = lambda: deployit.executeControlTask( task.name, self._ci) except: pass
def convertToDeployable(deployedId, pkgId): deployed = repository.read(deployedId) deployedDescriptor = DescriptorRegistry.getDescriptor(deployed.type) if (deployedDescriptor.type.instanceOf(Type.valueOf("udm.DeployedArtifact"))): print "Cannot convert artifact deployed [%s]. Ignoring " %(deployable.id) return None deployableDescriptor = DescriptorRegistry.getDescriptor(deployedDescriptor.deployableType) deployable = factory.configurationItem("%s/%s" % (pkgId, deployed.name), str(deployableDescriptor.type)) if (repository.exists(deployable.id)): print "[%s] already exists. Ignoring " %(deployable.id) return None print "Converting [%s] to type [%s]" % (deployedId, str(deployable.type)) for pd in deployableDescriptor.propertyDescriptors: deployedPd = deployedDescriptor.getPropertyDescriptor(pd.name) if (deployedPd): try: deployable[pdName] = deployed[pdName] except: deployable.values[pdName] = deployed[pdName] return deployable
def get_ci_object(ciType, id): if not DescriptorRegistry.exists(Type.valueOf(ciType)): raise ValueError('Unknown CI type %s' % ciType) type = Type.valueOf(ciType) configurationItem = type.descriptor.newInstance(id) return configurationItem
'jee': 12, 'overthere': 5, 'generic': 6, 'internal': 4 } def get_color(t): prefix = t.getPrefix() if prefix in colormap: return colormap[prefix] else: return 0 for d in DescriptorRegistry.getDescriptors(): hlist = [d.getType()] hlist.extend(d.getSuperClasses()) ctype = None for h in hlist: if ctype is not None: links[ctype] = h ctype = h types.add(ctype) prefixes.add(str(ctype.getPrefix())) gvscript = [ "digraph udm {", 'fontname = "%s" ' % fontname, "fontsize = %s " % fontsize ]
fontname = "Bitstream Vera Sans" fontsize = 8 colorscheme = "paired12" #colorize only core types and bundled plugins, the other will remain black. colormap = {'udm': 4, 'cloud': 1, 'mail': 2, 'core': 3, 'file': '8', 'sql': 9, 'www': 10, 'jee': 12, 'overthere': 5, 'generic': 6, 'internal': 4} def get_color(t): prefix = t.getPrefix() if prefix in colormap: return colormap[prefix] else: return 0 for d in DescriptorRegistry.getDescriptors(): hlist = [d.getType()] hlist.extend(d.getSuperClasses()) ctype = None for h in hlist: if ctype is not None: links[ctype] = h ctype = h types.add(ctype) prefixes.add(str(ctype.getPrefix())) gvscript = ["digraph udm {", 'fontname = "%s" ' % fontname, "fontsize = %s " % fontsize] gvscript.append('node [ fontname = "%s" fontsize = %s shape = "record" ]' % (fontname, fontsize)) gvscript.append('edge [ fontname = "%s" fontsize = %s ]' % (fontname, fontsize)) for k, v in links.items(): gvscript.append('"%s" -> "%s";' % (k, v))