示例#1
0
 def _load_assocs(self, firmwareassociations=None, profileassociations=None,
                  associations=None, siteassociations=None):
     """Load associations to AssociationsMap and set attributes."""
     self.firmwareassociations = AssociationsMap.from_list(
         firmwareassociations, 'firmware', **_NODESMAPKWARGS)
     self.profileassociations = AssociationsMap.from_list(
         profileassociations, 'profile', **_NODESMAPKWARGS)
     self.associations = associationsmapdict_from_dict(associations,
                                                       **_NODESMAPKWARGS)
     self.siteassociations = associationsmapdict_from_dict(siteassociations,
                                                           'sites')
示例#2
0
 def _load_assocs(self, firmwareassociations=None, profileassociations=None,
                  associations=None, siteassociations=None):
     """Load associations to AssociationsMap and set attributes."""
     self.firmwareassociations = AssociationsMap.from_list(
         firmwareassociations, 'firmware', **_NODESMAPKWARGS)
     self.profileassociations = AssociationsMap.from_list(
         profileassociations, 'profile', **_NODESMAPKWARGS)
     self.associations = associationsmapdict_from_dict(associations,
                                                       **_NODESMAPKWARGS)
     self.siteassociations = associationsmapdict_from_dict(siteassociations,
                                                           'sites')
示例#3
0
 def _siteassociations(self, assoctype):
     """Init and return associations[assoctype]."""
     assocs = setattr_if_none(self, 'siteassociations', {})
     return assocs.setdefault(assoctype,
                              AssociationsMap(assoctype, 'sites'))
示例#4
0
 def _associations(self, assoctype):
     """Init and return associations[assoctype]."""
     assocs = setattr_if_none(self, 'associations', {})
     return assocs.setdefault(assoctype,
                              AssociationsMap(assoctype, **_NODESMAPKWARGS))
示例#5
0
 def _profileassociations(self):
     """Init and return profileassociations."""
     return setattr_if_none(self, 'profileassociations',
                            AssociationsMap('profile', **_NODESMAPKWARGS))
示例#6
0
 def _firmwareassociations(self):
     """Init and return firmwareassociations."""
     return setattr_if_none(self, 'firmwareassociations',
                            AssociationsMap('firmware', **_NODESMAPKWARGS))
示例#7
0
def _add_siteassoc_to_dict(assocs, sites, assoctype, assocname):
    """Add given site association to 'assocs' dict."""
    name = site_association_name(assoctype, assocname)
    assoc = assocs.setdefault(assoctype, AssociationsMap(assoctype, 'sites'))
    assoc.extendvalues(name, sites)