ucsschool.lib.models package¶
Submodules¶
ucsschool.lib.models.attributes module¶
-
exception
ucsschool.lib.models.attributes.
ValidationError
[source]¶ Bases:
exceptions.Exception
-
class
ucsschool.lib.models.attributes.
Attribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
object
-
syntax
= None¶
-
extended
= False¶
-
value_type
= None¶
-
value_default
= None¶
-
udm_name
= None¶
-
-
class
ucsschool.lib.models.attributes.
CommonName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'name'¶
-
syntax
= None¶
-
-
class
ucsschool.lib.models.attributes.
Username
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= 'username'¶
-
syntax
¶ alias of
uid_umlauts
-
-
class
ucsschool.lib.models.attributes.
DHCPServerName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= 'server'¶
-
-
class
ucsschool.lib.models.attributes.
DHCPServiceName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= 'service'¶
-
-
class
ucsschool.lib.models.attributes.
GroupName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
syntax
¶ alias of
gid
-
Bases:
ucsschool.lib.models.attributes.CommonName
alias of
string_numbers_letters_dots_spaces
-
class
ucsschool.lib.models.attributes.
SubnetName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= 'subnet'¶
-
syntax
¶ alias of
reverseLookupSubnet
-
-
class
ucsschool.lib.models.attributes.
DHCPSubnetName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.SubnetName
-
udm_name
= 'subnet'¶
-
syntax
¶ alias of
ipv4Address
-
-
class
ucsschool.lib.models.attributes.
SchoolName
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= 'name'¶
-
-
class
ucsschool.lib.models.attributes.
DCName
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
Firstname
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'firstname'¶
-
-
class
ucsschool.lib.models.attributes.
Lastname
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'lastname'¶
-
-
class
ucsschool.lib.models.attributes.
Birthday
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'birthday'¶
-
syntax
¶ alias of
iso8601Date
-
-
class
ucsschool.lib.models.attributes.
Email
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'mailPrimaryAddress'¶
-
syntax
¶ alias of
primaryEmailAddressValidDomain
-
-
class
ucsschool.lib.models.attributes.
Password
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'password'¶
-
-
class
ucsschool.lib.models.attributes.
Disabled
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'disabled'¶
-
syntax
¶ alias of
disabled
-
-
class
ucsschool.lib.models.attributes.
SchoolAttribute
(label, aka=None)[source]¶ Bases:
ucsschool.lib.models.attributes.CommonName
-
udm_name
= None¶
-
-
class
ucsschool.lib.models.attributes.
SchoolClassesAttribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= None¶
-
-
class
ucsschool.lib.models.attributes.
SchoolClassAttribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
WorkgroupAttribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
Description
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'description'¶
-
-
class
ucsschool.lib.models.attributes.
DisplayName
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'displayName'¶
-
extended
= True¶
-
-
class
ucsschool.lib.models.attributes.
EmptyAttributes
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'emptyAttributes'¶
-
-
class
ucsschool.lib.models.attributes.
ContainerPath
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
syntax
¶ alias of
boolean
-
Bases:
ucsschool.lib.models.attributes.Attribute
alias of
UDM_Objects
-
class
ucsschool.lib.models.attributes.
Groups
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
syntax
¶ alias of
GroupDN
-
-
class
ucsschool.lib.models.attributes.
Users
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'users'¶
-
syntax
¶ alias of
UserDN
-
-
class
ucsschool.lib.models.attributes.
IPAddress
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'ip'¶
-
syntax
¶ alias of
ipAddress
-
-
class
ucsschool.lib.models.attributes.
SubnetMask
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
DHCPSubnetMask
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'subnetmask'¶
-
syntax
¶ alias of
v4netmask
-
-
class
ucsschool.lib.models.attributes.
DHCPServiceAttribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
BroadcastAddress
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'broadcastaddress'¶
-
syntax
¶ alias of
ipv4Address
-
-
class
ucsschool.lib.models.attributes.
NetworkBroadcastAddress
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
syntax
¶ alias of
ipv4Address
-
-
class
ucsschool.lib.models.attributes.
NetworkAttribute
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'network'¶
-
syntax
¶ alias of
ipAddress
-
-
class
ucsschool.lib.models.attributes.
Netmask
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'netmask'¶
-
syntax
¶ alias of
netmask
-
-
class
ucsschool.lib.models.attributes.
MACAddress
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'mac'¶
-
syntax
¶ alias of
MAC_Address
-
-
class
ucsschool.lib.models.attributes.
InventoryNumber
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶
-
class
ucsschool.lib.models.attributes.
Hosts
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'hosts'¶
-
syntax
¶ alias of
UDM_Objects
-
-
class
ucsschool.lib.models.attributes.
Schools
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'school'¶
-
syntax
¶ alias of
string
-
extended
= True¶
-
-
class
ucsschool.lib.models.attributes.
RecordUID
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'ucsschoolRecordUID'¶
-
syntax
¶ alias of
string
-
extended
= True¶
-
-
class
ucsschool.lib.models.attributes.
SourceUID
(label, aka=None, udm_name=None, required=False, unlikely_to_change=False, internal=False, map_to_udm=True)[source]¶ Bases:
ucsschool.lib.models.attributes.Attribute
-
udm_name
= 'ucsschoolSourceUID'¶
-
syntax
¶ alias of
string
-
extended
= True¶
-
-
class
ucsschool.lib.models.attributes.
RolesSyntax
[source]¶ Bases:
univention.admin.syntax.string
-
regex
= <_sre.SRE_Pattern object>¶
-
ucsschool.lib.models.base module¶
-
exception
ucsschool.lib.models.base.
MultipleObjectsError
(objs, *args, **kwargs)[source]¶ Bases:
exceptions.Exception
-
class
ucsschool.lib.models.base.
UCSSchoolHelperAbstractClass
(name=None, school=None, **kwargs)[source]¶ Bases:
object
Base class of all UCS@school models. Hides UDM.
Attributes used for a class are defined like this:
class MyModel(UCSSchoolHelperAbstractClass): my_attribute = Attribute('Label', required=True, udm_name='myAttr')
From there on
my_attribute=value
may be passed to :py:meth:__init__()
,my_model.my_attribute
can be accessed and the value will be saved asobj['myAttr']
in UDM when saving this instance. If an attribute of a base class is not wanted, it can be overridden:class MyModel(UCSSchoolHelperAbstractClass): school = None
Meta information about the class are defined like this:
class MyModel(UCSSchoolHelperAbstractClass): class Meta: udm_module = 'my/model'
The meta information is then accessible in
cls._meta
.Important functions:
- :py:meth:
__init__(**kwargs)
: - kwargs should be the defined attributes
- :py:meth:
create(lo)
- lo is an LDAP connection, specifically univention.admin.access. creates a new object. Returns False is the object already exists. And True after the creation
- :py:meth:
modify(lo)
- modifies an existing object. Returns False if the object does not exist and True after the modification (regardless whether something actually changed or not)
- :py:meth:
remove(lo)
- deletes the object. Returns False if the object does not exist and True after the deletion.
- :py:meth:
get_all(lo, school, filter_str, easy_filter=False)
classmethod; retrieves all objects found for this school. filter can be a string that is used to narrow down a search. Each property of the class’ udm_module that is include_in_default_search is queried for that string. Example:
User.get_all(lo, 'school', filter_str='name', easy_filter=True)
will search in
cn=users,ou=school,$base
for users/user UDM objects with|(username=*name*)(firstname=*name*)(...)
and return User objects (not UDM objects) Witheasy_filter=False
(default) it will use this veryfilter_str
- :py:meth:
get_container(school)
- a classmethod that points to the container where new instances are created and existing ones are searched.
- :py:meth:
dn
- property, current distinguishable name of the instance. Calculated on the fly, it
changes if instance.name or instance.school changes.
instance.old_dn
will be set to the original dn when the instance was created - :py:meth:
get_udm_object(lo)
- searches UDM for an entry that corresponds to
self
. Normally uses the old_dn or dn. Ifcls._meta.name_is_unique
then any object withself.name
will match - :py:meth:
exists(lo)
- whether this object can be found in UDM.
- :py:meth:
from_udm_obj(udm_obj, school, lo)
- classmethod; maps the info of
udm_obj
into a new instance (and setsschool
) - :py:meth:
from_dn(dn, school, lo)
- finds dn in LDAP and uses
from_udm_obj
- :py:meth:
get_first_udm_obj(lo, filter_str)
- returns the first found object of type
cls._meta.udm_module
that matches an arbitraryfilter_str
More features:
- Validation:
- There are some auto checks built in: Attributes of the model that have a
UDM syntax attached are validated against this syntax. Attributes that are
required must be present.
Attributes that are unlikely_to_change give a warning (not error) if the object
already exists with other values.
If the Meta information states that name_is_unique, the complete LDAP is searched
for the instance’s name before continuing.
:py:meth:
validate()
can be further customized. - Hooks:
Before :py:meth:
create
, :py:meth:modify
, :py:meth:move
and :py:meth:remove
, hooks are called if :py:meth:build_hook_line()
returns something. If the operation was successful, another set of hooks are called./usr/share/ucs-school-import/hooks/%(module)s_{create|modify|move|remove}_{pre|post}.d/
are called with the name of a temporary file containing the hook_line via run-parts.%(module)s
is'ucc'
forcls._meta.udm_module == 'computers/ucc'
by default and can be explicitely set with:class Meta: hook_path = 'computer'
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
_cache
= {}¶
-
_machine_connection
= None¶
-
_search_base_cache
= {}¶
-
_initialized_udm_modules
= []¶
-
_empty_hook_paths
= set([])¶
-
hook_sep_char
= '\t'¶
-
hook_path
= '/usr/share/ucs-school-import/hooks/'¶
-
name
= <ucsschool.lib.models.attributes.CommonName object>¶
-
school
= <ucsschool.lib.models.attributes.SchoolAttribute object>¶
-
classmethod
cache
(*args, **kwargs)[source]¶ Initializes a new instance and caches it for subsequent calls. Useful when using School.cache(school_name) a lot in different functions, in loops, etc.
-
classmethod
get_machine_connection
()[source]¶ get a cached ldap connection to the DC Master using this host’s credentials
-
position
¶
-
dn
¶ Generates a DN where the lib would assume this instance to be. Changing name or school of self will most likely change the outcome of self.dn as well
-
set_attributes
(**kwargs)[source]¶ A function to set the attributes of an UCS@school object in one function call. Only attributes that exist in self._attributes are set. The rest of the kwargs are simply ignored.
Parameters: kwargs – The attributes to set.
-
set_dn
(dn)[source]¶ Does not really set dn, as this is generated on-the-fly. Instead, sets old_dn in case it was missed in the beginning or after create/modify/remove/move Also resets cached udm_obj as it may point to somewhere else
-
call_hooks
(hook_time, func_name)[source]¶ Calls run-parts in os.path.join(self.hook_path, ‘%s_%s_%s.d’ % (self._meta.hook_path, func_name, hook_time)) if self.build_hook_line(hook_time, func_name) returns a non-empty string
- Usage in lib itself:
- hook_time in [‘pre’, ‘post’] func_name in [‘create’, ‘modify’, ‘remove’]
In the lib, post-hooks are only called if the corresponding function returns True
-
build_hook_line
(hook_time, func_name)[source]¶ Must be overridden if the model wants to support hooks. Do so by something like: return self._build_hook_line(self.attr1, self.attr2, ‘constant’)
-
create
(lo, validate=True)[source]¶ Creates a new UDM instance. Calls pre-hooks. If the object already exists, returns False. If the object does not yet exist, creates it, returns True and calls post-hooks.
-
create_without_hooks_roles
(lo)[source]¶ Run by py:meth:create_without_hooks() before py:meth:validate() (and thus before py:meth:do_create()).
-
do_create
(udm_obj, lo)[source]¶ Actual udm_obj manipulation. Override this if you want to further change values of udm_obj, e.g. def do_create(self, udm_obj, lo):
udm_obj[‘used_in_ucs_school’] = ‘1’ super(MyModel, self).do_create(udm_obj, lo)
-
modify
(lo, validate=True, move_if_necessary=None)[source]¶ Modifies an existing UDM instance. Calls pre-hooks. If the object does not exist, returns False. If the object exists, modifies it, returns True and calls post-hooks.
-
modify_without_hooks_roles
(udm_obj)[source]¶ Run by py:meth:modify_without_hooks() before py:meth:do_modify().
-
do_modify
(udm_obj, lo)[source]¶ Actual udm_obj manipulation. Override this if you want to further change values of udm_obj, e.g. def do_modify(self, udm_obj, lo):
udm_obj[‘used_in_ucs_school’] = ‘1’ super(MyModel, self).do_modify(udm_obj, lo)
-
remove
(lo)[source]¶ Removes an existing UDM instance. Calls pre-hooks. If the object does not exist, returns False. If the object exists, removes it, returns True and calls post-hooks.
-
get_udm_object
(lo)[source]¶ Returns the UDM object that corresponds to self. If self._meta.name_is_unique it searches for any UDM object with self.name. If not (which is the default) it searches for self.old_dn or self.dn Returns None if no object was found. Caches the result, even None If you want to re-search, you need to explicitely set self._udm_obj_searched = False
-
classmethod
get_container
(school)[source]¶ raises NotImplementedError by default. Needs to be overridden!
-
classmethod
get_all
(lo, school, filter_str=None, easy_filter=False, superordinate=None)[source]¶ Returns a list of all objects that can be found in cls.get_container() with the correct udm_module If filter_str is given, all udm properties with include_in_default_search are queried for that string (so that it should be the value)
-
classmethod
from_udm_obj
(udm_obj, school, lo)[source]¶ Creates a new instance with attributes of the udm_obj. Uses get_class_for_udm_obj()
-
classmethod
get_class_for_udm_obj
(udm_obj, school)[source]¶ Returns cls by default. Can be overridden for base classes: class User(UCSSchoolHelperAbstractClass):
@classmethod def get_class_for_udm_obj(cls, udm_obj, school)
- if something:
- return SpecialUser
return cls
- class SpecialUser(User):
- pass
Now, User.get_all() will return a list of User and SpecialUser objects If this function returns None for a udm_obj, that obj will not yield a new instance in get_all() and from_udm_obj() will return None for that udm_obj
-
classmethod
from_dn
(dn, school, lo, superordinate=None)[source]¶ Returns a new instance based on the UDM object found at dn raises noObject if the udm_module does not match the dn or dn is not found
-
classmethod
get_only_udm_obj
(lo, filter_str, superordinate=None, base=None)[source]¶ Returns the one UDM object of class cls._meta.udm_module that matches a given filter. If more than one is found, a MultipleObjectsError is raised If none is found, None is returned
-
classmethod
get_first_udm_obj
(lo, filter_str, superordinate=None)[source]¶ Returns the first UDM object of class cls._meta.udm_module that matches a given filter
-
to_dict
()[source]¶ Returns a dictionary somewhat representing this instance. This dictionary is usually used when sending the instance to a browser as JSON. By default the attributes are present as well as the dn and the udm_module.
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2529950 wrapping <logging.Logger object> at 0x7fe0a4c9e650 with factory <function <lambda>>>¶
- :py:meth:
-
class
ucsschool.lib.models.base.
RoleSupportMixin
[source]¶ Bases:
object
Attribute and methods to handle the ucsschool_roles / ucsschoolRoles attribute.
-
ucsschool_roles
= <ucsschool.lib.models.attributes.Roles object>¶
-
default_roles
= []¶
-
_school_in_name
= False¶
-
_school_in_name_prefix
= False¶
-
roles_as_dicts
¶ Get
self.ucsschool_roles
as a dict.
-
create_without_hooks_roles
(lo)[source]¶ Run by py:meth:create_without_hooks() before py:meth:validate() (and thus before py:meth:do_create()).
-
update_ucsschool_roles
()[source]¶ Run by py:meth:modify_without_hooks() before py:meth:validate().
Add
ucsschool_roles
entries of context_type=school to object, if it got new/additional school(s) and object has no role(s) in those yet.Delete
ucsschool_roles
entries of context_type=school of object, if it was removed from school(s).
-
ucsschool.lib.models.computer module¶
-
class
ucsschool.lib.models.computer.
AnyComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
AnyComputer.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
AnyComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
AnyComputer.
logger
= <Proxy at 0x7fe0a24e8518 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
SchoolDC
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24e8560 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
SchoolDCSlave
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.computer.SchoolDC
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
groups
= <ucsschool.lib.models.attributes.Groups object>¶
-
class
Meta
[source]¶ -
udm_module
= 'computers/domaincontroller_slave'¶
-
name_is_unique
= True¶
-
allow_school_change
= True¶
-
-
SchoolDCSlave.
_attributes
= {'groups': <ucsschool.lib.models.attributes.Groups object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}¶
-
SchoolDCSlave.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
SchoolDCSlave.
logger
= <Proxy at 0x7fe0a24e86c8 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
SchoolComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
ip_address
= <ucsschool.lib.models.attributes.IPAddress object>¶
-
subnet_mask
= <ucsschool.lib.models.attributes.SubnetMask object>¶
-
mac_address
= <ucsschool.lib.models.attributes.MACAddress object>¶
-
inventory_number
= <ucsschool.lib.models.attributes.InventoryNumber object>¶
-
zone
= <ucsschool.lib.models.attributes.Attribute object>¶
-
type_name
= 'Computer'¶
-
DEFAULT_PREFIX_LEN
= 24¶
-
classmethod
lookup
(lo, school, filter_s='', superordinate=None)[source]¶ This override limits the returned objects to actual ucsschoolComputers. Does not contain SchoolDC slaves and others anymore.
-
teacher_computer
¶ True if the computer is a teachers computer.
-
SchoolComputer.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>}¶
-
SchoolComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
SchoolComputer.
logger
= <Proxy at 0x7fe0a24e8878 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
WindowsComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.computer.SchoolComputer
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
type_name
= 'Windows system'¶
-
default_roles
= ['win_computer']¶
-
class
Meta
[source]¶ Bases:
ucsschool.lib.models.computer.Meta
-
udm_module
= 'computers/windows'¶
-
hook_path
= 'computer'¶
-
-
WindowsComputer.
_attributes
= {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}¶
-
WindowsComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
WindowsComputer.
logger
= <Proxy at 0x7fe0a24e8950 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
MacComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.computer.SchoolComputer
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
type_name
= 'Mac OS X'¶
-
default_roles
= ['mac_computer']¶
-
class
Meta
[source]¶ Bases:
ucsschool.lib.models.computer.Meta
-
udm_module
= 'computers/macos'¶
-
hook_path
= 'computer'¶
-
-
MacComputer.
_attributes
= {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}¶
-
MacComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
MacComputer.
logger
= <Proxy at 0x7fe0a24e8a28 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
IPComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.computer.SchoolComputer
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
type_name
= 'Device with IP address'¶
-
default_roles
= ['ip_computer']¶
-
class
Meta
[source]¶ Bases:
ucsschool.lib.models.computer.Meta
-
udm_module
= 'computers/ipmanagedclient'¶
-
hook_path
= 'computer'¶
-
-
IPComputer.
_attributes
= {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>}¶
-
IPComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
IPComputer.
logger
= <Proxy at 0x7fe0a24e8ab8 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.computer.
UCCComputer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.computer.SchoolComputer
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
type_name
= 'Univention Corporate Client'¶
-
class
Meta
[source]¶ Bases:
ucsschool.lib.models.computer.Meta
-
udm_module
= 'computers/ucc'¶
-
hook_path
= 'computer'¶
-
-
UCCComputer.
_attributes
= {'subnet_mask': <ucsschool.lib.models.attributes.SubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'inventory_number': <ucsschool.lib.models.attributes.InventoryNumber object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'zone': <ucsschool.lib.models.attributes.Attribute object>, 'mac_address': <ucsschool.lib.models.attributes.MACAddress object>, 'ip_address': <ucsschool.lib.models.attributes.IPAddress object>}¶
-
UCCComputer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
UCCComputer.
logger
= <Proxy at 0x7fe0a24e8b00 wrapping <logging.Logger object> at 0x7fe0a24e4c90 with factory <function <lambda>>>¶
-
ucsschool.lib.models.dhcp module¶
-
class
ucsschool.lib.models.dhcp.
DHCPService
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
name
= <ucsschool.lib.models.attributes.DHCPServiceName object>¶
-
hostname
= <ucsschool.lib.models.attributes.Attribute object>¶
-
domainname
= <ucsschool.lib.models.attributes.Attribute object>¶
-
add_server
(dc_name, lo, force_dhcp_server_move=False)[source]¶ Create the given DHCP server within the DHCP service. If the DHCP server object already exists somewhere else within the LDAP tree, it may be moved to the DHCP service.
PLEASE NOTE: In multiserver environments an existing DHCP server object is always moved to the current DHCP service. In single server environments the DHCP server object is ONLY moved, if the UCR variable dhcpd/ldap/base matches to the current DHCP service.
-
DHCPService.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'hostname': <ucsschool.lib.models.attributes.Attribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServiceName object>, 'domainname': <ucsschool.lib.models.attributes.Attribute object>}¶
-
DHCPService.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
DHCPService.
logger
= <Proxy at 0x7fe0a2529f38 wrapping <logging.Logger object> at 0x7fe0a4c9e910 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.dhcp.
AnyDHCPService
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.dhcp.DHCPService
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
school
= None¶
-
_attributes
= {'hostname': <ucsschool.lib.models.attributes.Attribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServiceName object>, 'domainname': <ucsschool.lib.models.attributes.Attribute object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24b6098 wrapping <logging.Logger object> at 0x7fe0a4c9e910 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.dhcp.
DHCPServer
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
name
= <ucsschool.lib.models.attributes.DHCPServerName object>¶
-
dhcp_service
= <ucsschool.lib.models.attributes.DHCPServiceAttribute object>¶
-
DHCPServer.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.DHCPServerName object>, 'dhcp_service': <ucsschool.lib.models.attributes.DHCPServiceAttribute object>}¶
-
DHCPServer.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
DHCPServer.
logger
= <Proxy at 0x7fe0a24b61b8 wrapping <logging.Logger object> at 0x7fe0a4c9e910 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.dhcp.
DHCPSubnet
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
name
= <ucsschool.lib.models.attributes.DHCPSubnetName object>¶
-
subnet_mask
= <ucsschool.lib.models.attributes.DHCPSubnetMask object>¶
-
broadcast
= <ucsschool.lib.models.attributes.BroadcastAddress object>¶
-
dhcp_service
= <ucsschool.lib.models.attributes.DHCPServiceAttribute object>¶
-
DHCPSubnet.
_attributes
= {'broadcast': <ucsschool.lib.models.attributes.BroadcastAddress object>, 'subnet_mask': <ucsschool.lib.models.attributes.DHCPSubnetMask object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.DHCPSubnetName object>, 'dhcp_service': <ucsschool.lib.models.attributes.DHCPServiceAttribute object>}¶
-
DHCPSubnet.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
DHCPSubnet.
logger
= <Proxy at 0x7fe0a24b6320 wrapping <logging.Logger object> at 0x7fe0a4c9e910 with factory <function <lambda>>>¶
-
ucsschool.lib.models.group module¶
-
class
ucsschool.lib.models.group.
EmailAttributesMixin
[source]¶ Bases:
object
-
email
= <ucsschool.lib.models.attributes.Email object>¶
-
allowed_email_senders_users
= <ucsschool.lib.models.attributes.Users object>¶
-
allowed_email_senders_groups
= <ucsschool.lib.models.attributes.Groups object>¶
-
-
class
ucsschool.lib.models.group.
Group
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
name
= <ucsschool.lib.models.attributes.GroupName object>¶
-
description
= <ucsschool.lib.models.attributes.Description object>¶
-
users
= <ucsschool.lib.models.attributes.Users object>¶
-
Group.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'users': <ucsschool.lib.models.attributes.Users object>}¶
-
Group.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
Group.
logger
= <Proxy at 0x7fe0a24dd950 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
BasicGroup
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.Group
-
school
= None¶
-
container
= <ucsschool.lib.models.attributes.Attribute object>¶
-
_attributes
= {'container': <ucsschool.lib.models.attributes.Attribute object>, 'users': <ucsschool.lib.models.attributes.Users object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'description': <ucsschool.lib.models.attributes.Description object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24dda28 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
BasicSchoolGroup
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.BasicGroup
-
school
= <ucsschool.lib.models.attributes.SchoolAttribute object>¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'container': <ucsschool.lib.models.attributes.Attribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>, 'users': <ucsschool.lib.models.attributes.Users object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24ddab8 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
SchoolGroup
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.Group
,ucsschool.lib.models.group._MayHaveSchoolSuffix
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
_attributes
= {'users': <ucsschool.lib.models.attributes.Users object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.GroupName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24ddb90 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
SchoolClass
(name=None, school=None, create_share=True, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.Group
,ucsschool.lib.models.group._MayHaveSchoolPrefix
-
name
= <ucsschool.lib.models.attributes.SchoolClassName object>¶
-
default_roles
= ['school_class']¶
-
_school_in_name_prefix
= True¶
alias of
ClassShare
-
_attributes
= {'users': <ucsschool.lib.models.attributes.Users object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'name': <ucsschool.lib.models.attributes.SchoolClassName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24ddcb0 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
WorkGroup
(name=None, school=None, create_share=True, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.EmailAttributesMixin
,ucsschool.lib.models.group.SchoolClass
,ucsschool.lib.models.group._MayHaveSchoolPrefix
-
default_roles
= ['workgroup']¶
alias of
WorkGroupShare
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.SchoolClassName object>, 'allowed_email_senders_users': <ucsschool.lib.models.attributes.Users object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'allowed_email_senders_groups': <ucsschool.lib.models.attributes.Groups object>, 'email': <ucsschool.lib.models.attributes.Email object>, 'users': <ucsschool.lib.models.attributes.Users object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24dddd0 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.group.
ComputerRoom
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.group.Group
,ucsschool.lib.models.group._MayHaveSchoolPrefix
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
hosts
= <ucsschool.lib.models.attributes.Hosts object>¶
-
users
= None¶
-
default_roles
= ['computer_room']¶
-
veyon_backend
¶ True if the computerroom is configured to use the new veyon backend instead of italc.
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'description': <ucsschool.lib.models.attributes.Description object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'hosts': <ucsschool.lib.models.attributes.Hosts object>, 'name': <ucsschool.lib.models.attributes.GroupName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24ddef0 wrapping <logging.Logger object> at 0x7fe0a24d8d50 with factory <function <lambda>>>¶
-
ucsschool.lib.models.meta module¶
ucsschool.lib.models.misc module¶
-
class
ucsschool.lib.models.misc.
MailDomain
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
school
= None¶
-
MailDomain.
_attributes
= {'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
MailDomain.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
MailDomain.
logger
= <Proxy at 0x7fe0a24b63b0 wrapping <logging.Logger object> at 0x7fe0a24c43d0 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.misc.
OU
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
OU.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
OU.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
OU.
logger
= <Proxy at 0x7fe0a24b63f8 wrapping <logging.Logger object> at 0x7fe0a24c43d0 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.misc.
Container
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.misc.OU
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
user_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
computer_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
network_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
group_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
dhcp_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
policy_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
printer_path
= <ucsschool.lib.models.attributes.ContainerPath object>¶
-
Container.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'policy_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'user_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'printer_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'computer_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'network_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'share_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'group_path': <ucsschool.lib.models.attributes.ContainerPath object>, 'dhcp_path': <ucsschool.lib.models.attributes.ContainerPath object>}¶
-
Container.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
Container.
logger
= <Proxy at 0x7fe0a24b6710 wrapping <logging.Logger object> at 0x7fe0a24c43d0 with factory <function <lambda>>>¶
-
ucsschool.lib.models.network module¶
-
class
ucsschool.lib.models.network.
Network
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
netmask
= <ucsschool.lib.models.attributes.Netmask object>¶
-
network
= <ucsschool.lib.models.attributes.NetworkAttribute object>¶
-
broadcast
= <ucsschool.lib.models.attributes.NetworkBroadcastAddress object>¶
-
_netmask_cache
= {}¶
-
Network.
_attributes
= {'broadcast': <ucsschool.lib.models.attributes.NetworkBroadcastAddress object>, 'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'netmask': <ucsschool.lib.models.attributes.Netmask object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'network': <ucsschool.lib.models.attributes.NetworkAttribute object>}¶
-
Network.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
Network.
logger
= <Proxy at 0x7fe0a24e83b0 wrapping <logging.Logger object> at 0x7fe09fff9f50 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.network.
DNSReverseZone
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
name
= <ucsschool.lib.models.attributes.SubnetName object>¶
-
school
= None¶
-
DNSReverseZone.
_attributes
= {'name': <ucsschool.lib.models.attributes.SubnetName object>}¶
-
DNSReverseZone.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
DNSReverseZone.
logger
= <Proxy at 0x7fe0a24e8440 wrapping <logging.Logger object> at 0x7fe09fff9f50 with factory <function <lambda>>>¶
-
ucsschool.lib.models.policy module¶
-
class
ucsschool.lib.models.policy.
Policy
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a24b6830 wrapping <logging.Logger object> at 0x7fe0a24c47d0 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.policy.
UMCPolicy
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.policy.Policy
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
UMCPolicy.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>}¶
-
UMCPolicy.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
UMCPolicy.
logger
= <Proxy at 0x7fe0a24b6908 wrapping <logging.Logger object> at 0x7fe0a24c47d0 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.policy.
DHCPDNSPolicy
(name=None, school=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.policy.Policy
Initializes a new instance with kwargs. Not every kwarg is accepted, though: The name must be defined as a attribute at class level (or by a base class). All attributes are initialized at least with None Sets self.old_dn to self.dn, i.e. the name in __init__ will determine the old_dn, changing it after __init__ will result in trying to move the object!
-
empty_attributes
= <ucsschool.lib.models.attributes.EmptyAttributes object>¶
-
DHCPDNSPolicy.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.CommonName object>, 'empty_attributes': <ucsschool.lib.models.attributes.EmptyAttributes object>}¶
-
DHCPDNSPolicy.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
DHCPDNSPolicy.
logger
= <Proxy at 0x7fe0a24b69e0 wrapping <logging.Logger object> at 0x7fe0a24c47d0 with factory <function <lambda>>>¶
-
ucsschool.lib.models.school module¶
-
class
ucsschool.lib.models.school.
School
(name=None, school=None, alter_dhcpd_base=None, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
-
name
= <ucsschool.lib.models.attributes.SchoolName object>¶
-
dc_name
= <ucsschool.lib.models.attributes.DCName object>¶
-
dc_name_administrative
= <ucsschool.lib.models.attributes.DCName object>¶
-
school
= None¶
-
educational_servers
= <ucsschool.lib.models.attributes.Attribute object>¶
-
administrative_servers
= <ucsschool.lib.models.attributes.Attribute object>¶
-
default_roles
= ['school']¶
-
_school_in_name
= True¶
-
display_name
= <ucsschool.lib.models.attributes.DisplayName object>¶
-
get_administrative_group_name
(group_type, domain_controller=True, ou_specific=False, as_dn=False)[source]¶
-
_remove_udm_object
(module, dn, lo, raise_exceptions=False)[source]¶ Tries to remove UDM object specified by given dn. Return None on success or error message.
-
class
Meta
[source]¶ -
udm_module
= 'container/ou'¶
-
udm_filter
= 'objectClass=ucsschoolOrganizationalUnit'¶
-
-
School.
_attributes
= {'dc_name': <ucsschool.lib.models.attributes.DCName object>, 'display_name': <ucsschool.lib.models.attributes.DisplayName object>, 'name': <ucsschool.lib.models.attributes.SchoolName object>, 'class_share_file_server': <ucsschool.lib.models.attributes.ShareFileServer object>, 'administrative_servers': <ucsschool.lib.models.attributes.Attribute object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'home_share_file_server': <ucsschool.lib.models.attributes.ShareFileServer object>, 'dc_name_administrative': <ucsschool.lib.models.attributes.DCName object>, 'educational_servers': <ucsschool.lib.models.attributes.Attribute object>}¶
-
School.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
School.
logger
= <Proxy at 0x7fe0a2475320 wrapping <logging.Logger object> at 0x7fe0a01e2090 with factory <function <lambda>>>¶
-
ucsschool.lib.models.user module¶
-
class
ucsschool.lib.models.user.
User
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.base.RoleSupportMixin
,ucsschool.lib.models.base.UCSSchoolHelperAbstractClass
-
name
= <ucsschool.lib.models.attributes.Username object>¶
-
schools
= <ucsschool.lib.models.attributes.Schools object>¶
-
firstname
= <ucsschool.lib.models.attributes.Firstname object>¶
-
lastname
= <ucsschool.lib.models.attributes.Lastname object>¶
-
birthday
= <ucsschool.lib.models.attributes.Birthday object>¶
-
email
= <ucsschool.lib.models.attributes.Email object>¶
-
password
= <ucsschool.lib.models.attributes.Password object>¶
-
disabled
= <ucsschool.lib.models.attributes.Disabled object>¶
-
type_name
= None¶
-
type_filter
= '(|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)(objectClass=ucsschoolStudent))'¶
-
_profile_path_cache
= {}¶
-
_samba_home_path_cache
= {}¶
-
roles
= []¶
-
default_roles
= []¶
-
default_options
= ()¶
-
school_classes
= <ucsschool.lib.models.attributes.SchoolClassesAttribute object>¶
-
User.
_User__check_object_class
(lo, object_class, fallback)¶
-
User.
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
User.
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
User.
logger
= <Proxy at 0x7fe0a2475ab8 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
Student
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.User
-
type_name
= 'Student'¶
-
type_filter
= '(&(objectClass=ucsschoolStudent)(!(objectClass=ucsschoolExam)))'¶
-
roles
= ['pupil']¶
-
default_options
= ('ucsschoolStudent',)¶
-
default_roles
= ['student']¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2475bd8 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
Teacher
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.User
-
type_name
= 'Teacher'¶
-
type_filter
= '(&(objectClass=ucsschoolTeacher)(!(objectClass=ucsschoolStaff)))'¶
-
roles
= ['teacher']¶
-
default_roles
= ['teacher']¶
-
default_options
= ('ucsschoolTeacher',)¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2475cf8 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
SchoolAdmin
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.User
-
type_name
= 'School Administrator'¶
-
type_filter
= '(objectClass=ucsschoolAdministrator)'¶
-
roles
= ['school_admin']¶
-
default_roles
= ['school_admin']¶
-
default_options
= ('ucsschoolAdministrator',)¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2475dd0 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
Staff
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.User
-
school_classes
= None¶
-
type_name
= 'Staff'¶
-
roles
= ['staff']¶
-
default_roles
= ['staff']¶
-
type_filter
= '(&(!(objectClass=ucsschoolTeacher))(objectClass=ucsschoolStaff))'¶
-
default_options
= ('ucsschoolStaff',)¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2475ea8 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
TeachersAndStaff
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.Teacher
-
type_name
= 'Teacher and Staff'¶
-
type_filter
= '(&(objectClass=ucsschoolStaff)(objectClass=ucsschoolTeacher))'¶
-
roles
= ['teacher', 'staff']¶
-
default_roles
= ['teacher', 'staff']¶
-
default_options
= ('ucsschoolStaff',)¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2475f80 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
-
class
ucsschool.lib.models.user.
ExamStudent
(*args, **kwargs)[source]¶ Bases:
ucsschool.lib.models.user.Student
-
type_name
= 'Exam student'¶
-
type_filter
= '(&(objectClass=ucsschoolStudent)(objectClass=ucsschoolExam))'¶
-
default_roles
= ['exam_user']¶
-
default_options
= ('ucsschoolExam',)¶
-
_attributes
= {'school': <ucsschool.lib.models.attributes.SchoolAttribute object>, 'name': <ucsschool.lib.models.attributes.Username object>, 'firstname': <ucsschool.lib.models.attributes.Firstname object>, 'lastname': <ucsschool.lib.models.attributes.Lastname object>, 'ucsschool_roles': <ucsschool.lib.models.attributes.Roles object>, 'school_classes': <ucsschool.lib.models.attributes.SchoolClassesAttribute object>, 'disabled': <ucsschool.lib.models.attributes.Disabled object>, 'birthday': <ucsschool.lib.models.attributes.Birthday object>, 'schools': <ucsschool.lib.models.attributes.Schools object>, 'password': <ucsschool.lib.models.attributes.Password object>, 'email': <ucsschool.lib.models.attributes.Email object>}¶
-
_meta
= <ucsschool.lib.models.meta.UCSSchoolHelperOptions object>¶
-
logger
= <Proxy at 0x7fe0a2496098 wrapping <logging.Logger object> at 0x7fe0a2488f10 with factory <function <lambda>>>¶
-
ucsschool.lib.models.utils module¶
-
exception
ucsschool.lib.models.utils.
NotInstalled
[source]¶ Bases:
exceptions.Exception
Raised by get_package_version() when the requested package is not installed.
-
exception
ucsschool.lib.models.utils.
UnknownPackage
[source]¶ Bases:
exceptions.Exception
Raised by get_package_version() when the requested package is not known in the Debian package cache.
-
class
ucsschool.lib.models.utils.
UniFileHandler
(filename, when='h', interval=1, backupCount=0, encoding=None, delay=False, utc=False, fuid=None, fgid=None, fmode=None)[source]¶ Bases:
logging.handlers.TimedRotatingFileHandler
TimedRotatingFileHandler that can set file permissions and removes password entries from from dicts in args.
-
class
ucsschool.lib.models.utils.
UniStreamHandler
(stream=None, fuid=None, fgid=None, fmode=None)[source]¶ Bases:
sphinx.ext.autodoc.StreamHandler
Colorizing console stream handler that removes password entries from from dicts in args.
fuid, fgid and fmode are here only for similarity of interface to UniFileHandler and are ignored.
-
class
ucsschool.lib.models.utils.
ModuleHandler
(level=0, udebug_facility=8)[source]¶ Bases:
logging.Handler
Adapter: use Python logging but emit through univention debug
-
LOGGING_TO_UDEBUG
= {'INFO': 2, 'WARN': 1, 'CRITICAL': 0, 'WARNING': 1, 'ERROR': 0, 'DEBUG': 3, 'NOTSET': 3}¶
-
-
class
ucsschool.lib.models.utils.
UCSTTYColoredFormatter
[source]¶ Bases:
sphinx.ext.autodoc.TTYColoredFormatter
Subclass of
colorlog.TTYColoredFormatter
that will force colorization on, in case UCSSCHOOL_FORCE_COLOR_TERM is found in env.
-
ucsschool.lib.models.utils.
add_stream_logger_to_schoollib
(level='DEBUG', stream=<open file '<stderr>', mode 'w'>, log_format=None, name=None)[source]¶ Outputs all log messages of the models code to a stream (default: “stderr”):
from ucsschool.lib.models.utils import add_stream_logger_to_schoollib add_module_logger_to_schoollib() # or: add_module_logger_to_schoollib(level='ERROR', stream=sys.stdout, log_format='ERROR (or worse): %(message)s')
-
ucsschool.lib.models.utils.
loglevel_int2str
(level)[source]¶ Convert numeric loglevel to string name.
-
ucsschool.lib.models.utils.
nearest_known_loglevel
(level)[source]¶ Get loglevel nearest to those known in CMDLINE_LOG_FORMATS and FILE_LOG_FORMATS.
-
ucsschool.lib.models.utils.
get_stream_handler
(level, stream=None, fmt=None, datefmt=None, fmt_cls=None)[source]¶ Create a colored stream handler, usually for the console.
Parameters: - level (int or str) – log level
- stream (file) – opened file to write to (/dev/stdout if None)
- fmt (str) – log message format (will be passt to a Formatter instance)
- datefmt (str) – date format (will be passt to a Formatter instance)
- fmt_cls (type) – Formatter class to use, defaults to
UCSTTYColoredFormatter
Returns: a handler
Return type: logging.Handler
-
ucsschool.lib.models.utils.
get_file_handler
(level, filename, fmt=None, datefmt=None, uid=None, gid=None, mode=None)[source]¶ Create a
UniFileHandler
(TimedRotatingFileHandler) for logging to a file.Parameters: - level (int or str) – log level
- filename (str) – path of file to write to
- fmt (str) – log message format (will be passt to a Formatter instance)
- datefmt (str) – date format (will be passt to a Formatter instance)
- uid (int) – user that the file should belong to (current user if None)
- gid (int) – group that the file should belong to (current users primary group if None)
- mode (int) – permissions of the file
Returns: a handler
Return type: logging.Handler
-
ucsschool.lib.models.utils.
get_logger
(name, level='INFO', target=<open file '<stdout>', mode 'w'>, handler_kwargs=None, formatter_kwargs=None)[source]¶ Get a logger object below the ucsschool root logger.
Deprecated since version 4.4: v2 Use logging.getLogger(__name__) and
get_stream_handler()
,get_file_handler()
.- The logger will use UniStreamHandler(StreamHandler) for streams (sys.stdout etc) and UniFileHandler(TimedRotatingFileHandler) for files if not configured differently through handler_kwargs[cls].
- A call with the same name will return the same logging object.
- There is only one handler per name-target combination.
- If name and target are the same, and only the log level changes, it will return the logging object with the same handlers and change both the log level of the respective handler and of the logger object to be the lowest of the previous and the new level.
- Complete output customization is possible, setting kwargs for the constructors of the handler and formatter.
- Using custom handler and formatter classes is possible by configuring the ‘cls’ key of handler_kwargs and formatter_kwargs.
Parameters: - name – str: will be appended to “ucsschool.” as name of the logger
- level – str: loglevel (DEBUG, INFO etc)
- target – stream (open file) or a str (file path)
- handler_kwargs – dict: will be passed to the handlers constructor. It cannot be used to modify a handler, as it is only used at creation time. If it has a key ‘cls’ it will be used as handler instead of UniFileHandler or UniStreamHandler. It should be a subclass of one of those!
- formatter_kwargs – dict: will be passed to the formatters constructor, if it has a key ‘cls’ it will be used to create a formatter instead of logging.Formatter.
Returns: a python logging object
-
ucsschool.lib.models.utils.
exec_cmd
(cmd, log=False, raise_exc=False, **kwargs)[source]¶ Execute command.
Parameters: Returns: 3-tuple: returncode (int), stdout (str), stderr (str)
Return type: tuple(int, str, str)
Raises: - subprocess.CalledProcessError – if raise_exc is True and the return code was != 0
- OSError – if cmd[0] does not exist: “No such file or directory”
-
ucsschool.lib.models.utils.
stopped_notifier
(*args, **kwds)[source]¶ Stops univention-directory-notifier while in a block and starts it in the end. Service if stopped/started by /etc/init.d.
Will not start if
ucr get notifier/autostart=no
– but will stop!with stopped_notifier(): ...
Parameters: strict (bool) – raise RuntimeError if stopping fails Raises: RuntimeError – if stopping failed and strict=True
-
ucsschool.lib.models.utils.
get_package_version
(package_name)[source]¶ Retrieve the version of the Debian package package_name from the Debian package cache.
Parameters: package_name (str) – name of Debian package
Returns: version of Debian package, if installed
Return type: Raises: - NotInstalled – if the package is not installed
- UnknownPackage – if the package is unknown