Beispiel #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')
Beispiel #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')
Beispiel #3
0
 def _siteassociations(self, assoctype):
     """Init and return associations[assoctype]."""
     assocs = setattr_if_none(self, 'siteassociations', {})
     return assocs.setdefault(assoctype,
                              AssociationsMap(assoctype, 'sites'))
Beispiel #4
0
 def _associations(self, assoctype):
     """Init and return associations[assoctype]."""
     assocs = setattr_if_none(self, 'associations', {})
     return assocs.setdefault(assoctype,
                              AssociationsMap(assoctype, **_NODESMAPKWARGS))
Beispiel #5
0
 def _profileassociations(self):
     """Init and return profileassociations."""
     return setattr_if_none(self, 'profileassociations',
                            AssociationsMap('profile', **_NODESMAPKWARGS))
Beispiel #6
0
 def _firmwareassociations(self):
     """Init and return firmwareassociations."""
     return setattr_if_none(self, 'firmwareassociations',
                            AssociationsMap('firmware', **_NODESMAPKWARGS))
Beispiel #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)