Exemplo n.º 1
0
def change_conf_attr(topology_st, suffix, attr_name, attr_value):
    """Change configurational attribute in the given suffix.

    Returns previous attribute value.
    """

    entry = DSLdapObject(topology_st.standalone, suffix)

    attr_value_bck = entry.get_attr_val_bytes(attr_name)
    log.info('Set %s to %s. Previous value - %s. Modified suffix - %s.' %
             (attr_name, attr_value, attr_value_bck, suffix))
    if attr_value is None:
        entry.remove_all(attr_name)
    else:
        entry.replace(attr_name, attr_value)
    return attr_value_bck
Exemplo n.º 2
0
 def set(self, value_pairs):
     for attr, val in value_pairs:
         attr = attr.lower()
         if attr in self._global_attrs:
             global_config = DSLdapObject(self._instance, dn=self._dn)
             global_config.replace(attr, val)
         elif attr in self._db_attrs['bdb']:
             db_config = DSLdapObject(self._instance, dn=self._db_dn)
             db_config.replace(attr, val)
         elif attr in self._db_attrs['lmdb']:
             pass
         else:
             # Unknown attribute
             raise ValueError(
                 "Can not update database configuration with unknown attribute: "
                 + attr)