Package syspolicy :: Package modules :: Module quota :: Class Quota
[hide private]
[frames] | no frames]

Class Quota

source code

module.Module --+
                |
               Quota

This module provides Linux quota configuration support for SysPolicy.

Instance Methods [hide private]
 
__init__(self) source code
 
cs_rem_attribute(self, group, attribute, value, diff)
Null handler for removing an attribute from the policy.
source code
 
cs_set_attribute(self, group, attribute, value, diff)
This function returns a ChangeSet for setting user- and group quotas based on the policy.
source code
 
c_set_quota(self, quota, type, object)
This function expands a dictionary of key-value pairs in the quota variable so that a separate Change operation is given for each key (a filesystem mount point) and value (amount of quota).
source code
 
event_user_modified(self, event, changeset)
This function catches user modification events and updates their quota accordingly if it's needed.
source code
 
event_user_removed(self, event, changeset)
This function catches user removal events and removes their quota before the user is removed from the system.
source code
 
event_group_added(self, event, changeset)
This function catches group addition events and sets their quota if it's needed.
source code
 
event_group_removed(self, event, changeset)
This function catches group removal events and removes their quota before the group is removed from the system.
source code
 
set_quota(self, change)
This function implements set_quota Changes by executing setquota according to the parameters which are given in the Change.
source code

Inherited from module.Module: append_lines_to_file, cs_check_diff, cs_new_attribute, cs_set_default, edit_configfile, execute, perform_change

Class Variables [hide private]

Inherited from module.Module: change_operations, diff_operations, event_hooks, handled_attributes, name, pt

Method Details [hide private]

__init__(self)
(Constructor)

source code 
Overrides: module.Module.__init__

cs_rem_attribute(self, group, attribute, value, diff)

source code 

Null handler for removing an attribute from the policy.

Parameters:
  • group - The group for which the attribute is being set
  • attribute - The attribute in the policy that is being set
  • value - The new value
  • diff - The difference from the old value
Returns:
A ChangeSet or None
Overrides: module.Module.cs_rem_attribute
(inherited documentation)

cs_set_attribute(self, group, attribute, value, diff)

source code 

This function returns a ChangeSet for setting user- and group quotas based on the policy. In case user quotas are being changed for the group, it queries for all the members of the group and returns a Change element for setting the quota for each of them.

Parameters:
  • group - The group for which the attribute is being set
  • attribute - The attribute in the policy that is being set
  • value - The new value
  • diff - The difference from the old value
Returns:
A ChangeSet or None
Overrides: module.Module.cs_set_attribute

c_set_quota(self, quota, type, object)

source code 

This function expands a dictionary of key-value pairs in the quota variable so that a separate Change operation is given for each key (a filesystem mount point) and value (amount of quota).

Parameters:
  • quota - Dictionary of mountpoints and their quota
  • type - Type of the quota being set ('user' or 'group')
  • object - The name of the user or group for which quota is set
Returns:
List of Change elements which set the quota

event_user_modified(self, event, changeset)

source code 

This function catches user modification events and updates their quota accordingly if it's needed. Such changes in quota often come from changed main group.

The function appends any Change elements to the provided ChangeSet.

Parameters:
  • event - The event that was triggered
  • changeset - The ChangeSet triggering the event

event_user_removed(self, event, changeset)

source code 

This function catches user removal events and removes their quota before the user is removed from the system.

The function inserts any Change elements to the provided ChangeSet, before the actual user deletion Changes.

Parameters:
  • event - The event that was triggered
  • changeset - The ChangeSet triggering the event

event_group_added(self, event, changeset)

source code 

This function catches group addition events and sets their quota if it's needed.

The function appends any Change elements to the provided ChangeSet.

Parameters:
  • event - The event that was triggered
  • changeset - The ChangeSet triggering the event

event_group_removed(self, event, changeset)

source code 

This function catches group removal events and removes their quota before the group is removed from the system.

The function inserts any Change elements to the provided ChangeSet, before the actual user deletion Changes.

Parameters:
  • event - The event that was triggered
  • changeset - The ChangeSet triggering the event

set_quota(self, change)

source code 

This function implements set_quota Changes by executing setquota according to the parameters which are given in the Change.

Parameters:
  • change - The set_quota Change element
Returns:
The return value from self.execute(cmd)