def construct(self):
        tagname = xmlutil.Selector('key')

        def extraspec_sel(obj, do_raise=False):
            # Have to extract the key and value for later use...
            key, value = obj.items()[0]
            return dict(key=key, value=value)

        root = xmlutil.TemplateElement(tagname, selector=extraspec_sel)
        root.text = 'value'
        return xmlutil.MasterTemplate(root, 1)
Exemple #2
0
    def construct(self):
        root = xmlutil.TemplateElement('services')
        elem = xmlutil.SubTemplateElement(root, 'service', selector='services')
        elem.set('binary')
        elem.set('host')
        elem.set('zone')
        elem.set('status')
        elem.set('state')
        elem.set('update_at')
        elem.set('disabled_reason')

        return xmlutil.MasterTemplate(root, 1)
Exemple #3
0
    def construct(self):
        # TODO(uni): template elements of 'host', 'service' and 'disabled'
        # should be deprecated to make ServicesUpdateTemplate consistent
        # with ServicesIndexTemplate. Still keeping it here for API
        # compatibility sake.
        root = xmlutil.TemplateElement('host')
        root.set('host')
        root.set('service')
        root.set('disabled')
        root.set('binary')
        root.set('status')
        root.set('disabled_reason')

        return xmlutil.MasterTemplate(root, 1)
Exemple #4
0
 def construct(self):
     root = xmlutil.TemplateElement('storage_tiers')
     elem = xmlutil.SubTemplateElement(root, 'storage_tier',
                                       selector='storage_tiers')
     make_backendtype(elem)
     return xmlutil.MasterTemplate(root, 1)
Exemple #5
0
 def construct(self):
     sel = xmlutil.Selector('meta', xmlutil.get_items, 0)
     root = xmlutil.TemplateElement('meta', selector=sel)
     root.set('key', 0)
     root.text = 1
     return xmlutil.MasterTemplate(root, 1, nsmap=metadata_nsmap)