appngizer package¶
appngizer.client module¶
This module contains network clients which are used to communicate with an appNGizer instance.
Currently there is only an implementation of a XMLClient
.
-
class
appngizer.client.
Client
(url, sharedsecret)[source]¶ Bases:
object
Abstract class of an appNGizer client All further appNGizer clients will inherits from this class
-
class
appngizer.client.
ClientNetwork
[source]¶ Bases:
object
appNGizer ClientNetwork class
-
class
appngizer.client.
Singleton
[source]¶ Bases:
type
Singleton class pattern to be used as metaclass for the
Client
.
-
class
appngizer.client.
XMLClient
(url, sharedsecret)[source]¶ Bases:
appngizer.client.Client
appNGizer XML Client class
appngizer.elements module¶
This module contains all appNG entities which currently can managed via an appNGizer instance.
-
class
appngizer.elements.
Application
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage an application
-
ATTRIBUTES
= {'name': ''}¶
-
FIELDS
= OrderedDict([('displayName', ''), ('privileged', False), ('fileBased', False), ('hidden', False), ('version', '')])¶
-
TYPE
= 'Application'¶
-
TYPE_C
= 'Applications'¶
-
delete
()[source]¶ Deletes an application
With additional check if application is assigned to any site before try to delete
Returns: bool (True if deleted)
-
is_assigned
(site)[source]¶ Check if application is assigned to a site
Returns: bool (True if is assigned)
-
is_update_needed
(**xdict)[source]¶ Check if update of application settings is needed
Parameters: Returns: bool (True if needed), lxml.etree.Element (current), lxml.etree.Element (updated)
-
-
class
appngizer.elements.
Applications
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage applications
-
SUBELEMENTS
= {'application': []}¶
-
TYPE
= 'Application'¶
-
TYPE_C
= 'Applications'¶
-
-
class
appngizer.elements.
Database
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage site application databases of an appNG instance
-
ATTRIBUTES
= {'id': ''}¶
-
CHILDS
= OrderedDict()¶
-
FIELDS
= OrderedDict([('type', ''), ('user', ''), ('password', ''), ('dbVersion', ''), ('driver', ''), ('url', ''), ('ok', '')])¶
-
TYPE
= 'Database'¶
-
TYPE_C
= 'Databases'¶
-
gen_password_hash
(password, salt)[source]¶ Generate bcrypt hash from plaintext password and salt
Parameters: Returns: str
-
-
class
appngizer.elements.
Databases
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage databases
-
SUBELEMENTS
= {'database': []}¶
-
TYPE
= 'Database'¶
-
TYPE_C
= 'Databases'¶
-
-
class
appngizer.elements.
Element
(name='', parents=[])[source]¶ Bases:
appngizer.elements.XMLElement
Abstract class of an appNG entity
-
get_url_dict
()[source]¶ Return dictionary with url path components of the entity
url[‘self’] url path to entity url[‘ancestor’] url path to entity type url[‘parents’] url path of parent entitiesReturns: dict
-
-
class
appngizer.elements.
Elements
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Abstract class of an appNGizer container element
-
class
appngizer.elements.
Grant
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a site application grant
-
TYPE
= 'Grant'¶
-
TYPE_C
= 'Grant'¶
-
-
class
appngizer.elements.
Grants
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage site application grants
-
SUBELEMENTS
= {'grant': []}¶
-
TYPE
= 'Grant'¶
-
TYPE_C
= 'Grants'¶
-
get_grant
(name)[source]¶ Get grant ObjectifiedElement of a site :param str name: Name of site :return: lxml.objectify.ObjectifiedElement
-
get_url_dict
()[source]¶ Return dictionary with url path components of the entity
url[‘self’] url path to entity url[‘ancestor’] url path to entity type url[‘parents’] url path of parent entitiesReturns: dict
-
is_update_needed
(**xdict)[source]¶ Check if update of Grants is needed
Parameters: xdict['grant'] (str) – List of grant lxml.objectify.ObjectifiedElements Returns: bool (True if needed), lxml.etree.Element (current), lxml.etree.Element (updated)
-
-
class
appngizer.elements.
Group
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a group
-
ATTRIBUTES
= {'name': ''}¶
-
CHILDS
= OrderedDict([('roles', None)])¶
-
FIELDS
= OrderedDict([('description', '')])¶
-
PRESERVED_FIELDS
= ['description']¶
-
TYPE
= 'Group'¶
-
TYPE_C
= 'Groups'¶
-
-
class
appngizer.elements.
Groups
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage groups
-
SUBELEMENTS
= {'group': []}¶
-
TYPE
= 'Group'¶
-
TYPE_C
= 'Groups'¶
-
-
class
appngizer.elements.
Package
(name=None, parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a package
-
ATTRIBUTES
= {'name': ''}¶
-
FIELDS
= OrderedDict([('displayName', ''), ('version', ''), ('timestamp', ''), ('installed', False), ('type', 'APPLICATION')])¶
-
TYPE
= 'Package'¶
-
TYPE_C
= 'Packages'¶
-
is_installed
(**xdict)[source]¶ Check if a package is already installed
Parameters: xdict['type'] (str) – Type of package (APPLICATION|TEMPLATE) Returns: bool (True if installed)
-
-
class
appngizer.elements.
Packages
(name=None, parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage packages
-
SUBELEMENTS
= {'package': []}¶
-
TYPE
= 'Package'¶
-
TYPE_C
= 'Packages'¶
-
-
class
appngizer.elements.
Permission
(name=None, parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a permission
-
ATTRIBUTES
= {'name': ''}¶
-
FIELDS
= OrderedDict([('application', ''), ('description', '')])¶
-
PRESERVED_FIELDS
= ['description']¶
-
TYPE
= 'Permission'¶
-
TYPE_C
= 'Permissions'¶
-
create
(**xdict)[source]¶ Create permission
Parameters: xdict['description'] (str) – Short description of permission Returns: lxml.etree.Element
-
-
class
appngizer.elements.
Permissions
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage permissions
-
SUBELEMENTS
= {'permission': []}¶
-
TYPE
= 'Permission'¶
-
TYPE_C
= 'Permissions'¶
-
-
class
appngizer.elements.
Platform
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage the platform
-
TYPE
= 'Platform'¶
-
TYPE_C
= 'Platform'¶
-
-
class
appngizer.elements.
Properties
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage properties
-
SUBELEMENTS
= {'property': []}¶
-
TYPE
= 'Property'¶
-
TYPE_C
= 'Properties'¶
-
-
class
appngizer.elements.
Property
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a property
-
ATTRIBUTES
= {'name': '', 'clob': False}¶
-
FIELDS
= OrderedDict([('value', ''), ('defaultValue', ''), ('description', '')])¶
-
PRESERVED_FIELDS
= ['description', 'defaultValue']¶
-
TYPE
= 'Property'¶
-
TYPE_C
= 'Properties'¶
-
-
class
appngizer.elements.
Repositories
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage repositories
-
SUBELEMENTS
= {'repository': []}¶
-
TYPE
= 'Repository'¶
-
TYPE_C
= 'Repositories'¶
-
-
class
appngizer.elements.
Repository
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a repository
-
ATTRIBUTES
= {'name': ''}¶
-
FIELDS
= OrderedDict([('description', ''), ('remoteName', None), ('uri', None), ('enabled', True), ('strict', False), ('published', False), ('mode', 'ALL'), ('type', 'LOCAL'), ('packages', None)])¶
-
PRESERVED_FIELDS
= ['description']¶
-
TYPE
= 'Repository'¶
-
TYPE_C
= 'Repositories'¶
-
create
(**xdict)[source]¶ Create repository
Parameters: - xdict['description'] (str) – Short description of repository
- xdict['remoteName'] (str) – Remote name of a remote repository
- xdict['uri']* (str) – URI to repository
- xdict['enabled'] (bool) – Enable repository
- xdict['strict'] (bool) – Use strict mode for repository
- xdict['published'] (bool) – Publish this repository as remote repository
- xdict['mode'] (str) – Type of packages to serve (ALL|STABLE|SNAPSHOT)
- xdict['type'] (str) – Type of repository (LOCAL|REMOTE)
Returns: lxml.etree.Element
-
has_pkg
(**xdict)[source]¶ Check if repository have a package
Parameters: xdict['name']* (str) – name of package Returns: bool (True if has package)
-
is_update_needed
(**xdict)[source]¶ Check if update of repository is needed
Parameters: - xdict['description'] (str) – Short description of repository
- xdict['remoteName'] (str) – Remote name of a remote repository
- xdict['uri'] (str) – URI to repository
- xdict['enabled'] (bool) – Enable repository
- xdict['strict'] (bool) – Use strict mode for repository
- xdict['published'] (bool) – Publish this repository as remote repository
- xdict['mode'] (str) – Type of packages to serve (ALL|STABLE|SNAPSHOT)
- xdict['type'] (str) – Type of repository (LOCAL|REMOTE)
Returns: bool (True if needed), lxml.etree.Element (current), lxml.etree.Element (updated)
-
list_pkg
(**xdict)[source]¶ Get a list of all variants of a package in the repository
Parameters: xdict['name']* (str) – name of package Returns: lxml.objectify.ObjectifiedElement
-
list_pkgs
()[source]¶ Get a list of all packages in the repository
Returns: lxml.objectify.ObjectifiedElement
-
update
(**xdict)[source]¶ Update repository
Parameters: - xdict['description'] (str) – Short description of repository
- xdict['remoteName'] (str) – Remote name of a remote repository
- xdict['uri'] (str) – URI to repository
- xdict['enabled'] (bool) – Enable repository
- xdict['strict'] (bool) – Use strict mode for repository
- xdict['published'] (bool) – Publish this repository as remote repository
- xdict['mode'] (str) – Type of packages to serve (ALL|STABLE|SNAPSHOT)
- xdict['type'] (str) – Type of repository (LOCAL|REMOTE)
Returns: lxml.etree.Element
-
-
class
appngizer.elements.
Role
(name=None, parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a role
-
ATTRIBUTES
= {'name': ''}¶
-
CHILDS
= OrderedDict([('permissions', None)])¶
-
FIELDS
= OrderedDict([('application', ''), ('description', '')])¶
-
PRESERVED_FIELDS
= ['description']¶
-
TYPE
= 'Role'¶
-
TYPE_C
= 'Roles'¶
-
-
class
appngizer.elements.
Roles
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage roles
-
SUBELEMENTS
= {'role': []}¶
-
TYPE
= 'Role'¶
-
TYPE_C
= 'Roles'¶
-
-
class
appngizer.elements.
Site
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a site
-
ATTRIBUTES
= OrderedDict([('name', '')])¶
-
FIELDS
= OrderedDict([('host', ''), ('domain', ''), ('description', ''), ('active', True), ('createRepositoryPath', False)])¶
-
PRESERVED_FIELDS
= ['description', 'domain']¶
-
TYPE
= 'Site'¶
-
TYPE_C
= 'Sites'¶
-
is_update_needed
(**xdict)[source]¶ Check if update of site is needed
Parameters: Returns: bool (True if needed), lxml.etree.Element (current), lxml.etree.Element (updated)
-
-
class
appngizer.elements.
Sites
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage sites
-
SUBELEMENTS
= {'site': []}¶
-
TYPE
= 'Site'¶
-
TYPE_C
= 'Sites'¶
-
-
class
appngizer.elements.
Subject
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Element
Class to manage a subject
-
ATTRIBUTES
= {'name': ''}¶
-
CHILDS
= OrderedDict([('groups', None)])¶
-
FIELDS
= OrderedDict([('realName', ''), ('email', ''), ('description', ''), ('digest', ''), ('timeZone', 'Europe/Berlin'), ('language', 'en'), ('type', 'LOCAL_USER')])¶
-
PRESERVED_FIELDS
= ['description', 'email', 'timeZone', 'language', 'type']¶
-
TYPE
= 'Subject'¶
-
TYPE_C
= 'Subjects'¶
-
create
(**xdict)[source]¶ Create subject
Parameters: - xdict['realName']* (str) – Real name of subject
- xdict['email']* (str) – E-Mail address of subject
- xdict['description'] (str) – Short description of subject
- xdict['digest']* (str) – Password as plaintext or bcrypt hash
- xdict['timeZone'] (str) – Timezone for subject
- xdict['language'] (str) – Language for subject
- xdict['type'] (str) – Type of subject (LOCAL_USER|GLOBAL_USER|GLOBAL_GROUP)
Returns: lxml.etree.Element
-
digest_match_hash
(digest, hashed)[source]¶ Check if digest match hash
If digest does not start with ‘$2a$’ it will handled as plaintext otherwise digest is directly matched against hashed
Parameters: Returns: bool (True if match)
-
is_update_needed
(**xdict)[source]¶ Check if update of subject is needed
Parameters: - xdict['realName'] (str) – Real name of subject
- xdict['email'] (str) – E-Mail address of subject
- xdict['description'] (str) – Short description of subject
- xdict['digest'] (str) – Password as plaintext or bcrypt hash
- xdict['timeZone'] (str) – Timezone for subject
- xdict['language'] (str) – Language for subject
- xdict['type'] (str) – Type of subject (LOCAL_USER|GLOBAL_USER|GLOBAL_GROUP)
Returns: bool (True if needed), lxml.etree.Element (current), lxml.etree.Element (updated)
-
update
(**xdict)[source]¶ Update subject
Parameters: - xdict['realName'] (str) – Real name of subject
- xdict['email'] (str) – E-Mail address of subject
- xdict['description'] (str) – Short description of subject
- xdict['digest'] (str) – Password as plaintext or bcrypt hash
- xdict['timeZone'] (str) – Timezone for subject
- xdict['language'] (str) – Language for subject
- xdict['type'] (str) – Type of subject (LOCAL_USER|GLOBAL_USER|GLOBAL_GROUP)
Returns: lxml.etree.Element
-
-
class
appngizer.elements.
Subjects
(name='', parents=[])[source]¶ Bases:
appngizer.elements.Elements
Class to manage subjects
-
SUBELEMENTS
= {'subject': []}¶
-
TYPE
= 'Subject'¶
-
TYPE_C
= 'Subjects'¶
-
-
class
appngizer.elements.
XMLElement
[source]¶ Bases:
object
Abstract class for an XML appNG entity
-
ATTRIBUTES
= OrderedDict()¶
-
CDATA_FIELDS
= []¶
-
CHILDS
= OrderedDict()¶
-
FIELDS
= OrderedDict()¶
-
NS_PREFIX
= '{http://www.appng.org/schema/appngizer}'¶
-
PRESERVED_FIELDS
= []¶
-
SUBELEMENTS
= OrderedDict()¶
-
TYPE
= 'Element'¶
-
TYPE_C
= 'Elements'¶
-
XPATH_DEFAULT_NAMESPACE
= {'a': 'http://www.appng.org/schema/appngizer'}¶
-
XSD_APPNGIZER_PATH
= '/usr/lib/python2.7/dist-packages/appngizer/appngizer.xsd'¶
-
convert_xml_element_to_xml_obj
(xml=None)[source]¶ Convert
lxml.etree.Element
tolxml.objectify.ObjectifiedElement
Parameters: xml (lxml.etree.Element) – Element to convert Returns: lxml.objectify.ObjectifiedElement
-
convert_xml_obj_to_xml_element
(xml_obj=None)[source]¶ Convert
lxml.objectify.ObjectifiedElement
tolxml.etree.Element
Parameters: xml_obj (lxml.objectify.ObjectifiedElement) – Element to convert Returns: lxml.etree.Element
-
dump
(xml=None)[source]¶ Pretty print an
lxml.etree.Element
orlxml.objectify.ObjectifiedElement
as stringParameters: - xml(1) (lxml.etree.Element) – Element to pretty print
- xml(2) (lxml.objectify.ObjectifiedElement) – Element to pretty print
Returns: string
-
get_xml_str
(xml_obj=None)[source]¶ Copy, deannotate and return as a
lxml.objectify.ObjectifiedElement
as stringParameters: xml_obj (lxml.objectify.ObjectifiedElement) – Element to return as string Returns: string
-