-
-
-
-
diff --git a/docs/crarr.png b/docs/crarr.png
deleted file mode 100644
index 26b43c5..0000000
Binary files a/docs/crarr.png and /dev/null differ
diff --git a/docs/epydoc.css b/docs/epydoc.css
deleted file mode 100644
index 86d4170..0000000
--- a/docs/epydoc.css
+++ /dev/null
@@ -1,322 +0,0 @@
-
-
-/* Epydoc CSS Stylesheet
- *
- * This stylesheet can be used to customize the appearance of epydoc's
- * HTML output.
- *
- */
-
-/* Default Colors & Styles
- * - Set the default foreground & background color with 'body'; and
- * link colors with 'a:link' and 'a:visited'.
- * - Use bold for decision list terms.
- * - The heading styles defined here are used for headings *within*
- * docstring descriptions. All headings used by epydoc itself use
- * either class='epydoc' or class='toc' (CSS styles for both
- * defined below).
- */
-body { background: #ffffff; color: #000000; }
-p { margin-top: 0.5em; margin-bottom: 0.5em; }
-a:link { color: #0000ff; }
-a:visited { color: #204080; }
-dt { font-weight: bold; }
-h1 { font-size: +140%; font-style: italic;
- font-weight: bold; }
-h2 { font-size: +125%; font-style: italic;
- font-weight: bold; }
-h3 { font-size: +110%; font-style: italic;
- font-weight: normal; }
-code { font-size: 100%; }
-/* N.B.: class, not pseudoclass */
-a.link { font-family: monospace; }
-
-/* Page Header & Footer
- * - The standard page header consists of a navigation bar (with
- * pointers to standard pages such as 'home' and 'trees'); a
- * breadcrumbs list, which can be used to navigate to containing
- * classes or modules; options links, to show/hide private
- * variables and to show/hide frames; and a page title (using
- *
). The page title may be followed by a link to the
- * corresponding source code (using 'span.codelink').
- * - The footer consists of a navigation bar, a timestamp, and a
- * pointer to epydoc's homepage.
- */
-h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; }
-h2.epydoc { font-size: +130%; font-weight: bold; }
-h3.epydoc { font-size: +115%; font-weight: bold;
- margin-top: 0.2em; }
-td h3.epydoc { font-size: +115%; font-weight: bold;
- margin-bottom: 0; }
-table.navbar { background: #a0c0ff; color: #000000;
- border: 2px groove #c0d0d0; }
-table.navbar table { color: #000000; }
-th.navbar-select { background: #70b0ff;
- color: #000000; }
-table.navbar a { text-decoration: none; }
-table.navbar a:link { color: #0000ff; }
-table.navbar a:visited { color: #204080; }
-span.breadcrumbs { font-size: 85%; font-weight: bold; }
-span.options { font-size: 70%; }
-span.codelink { font-size: 85%; }
-td.footer { font-size: 85%; }
-
-/* Table Headers
- * - Each summary table and details section begins with a 'header'
- * row. This row contains a section title (marked by
- * 'span.table-header') as well as a show/hide private link
- * (marked by 'span.options', defined above).
- * - Summary tables that contain user-defined groups mark those
- * groups using 'group header' rows.
- */
-td.table-header { background: #70b0ff; color: #000000;
- border: 1px solid #608090; }
-td.table-header table { color: #000000; }
-td.table-header table a:link { color: #0000ff; }
-td.table-header table a:visited { color: #204080; }
-span.table-header { font-size: 120%; font-weight: bold; }
-th.group-header { background: #c0e0f8; color: #000000;
- text-align: left; font-style: italic;
- font-size: 115%;
- border: 1px solid #608090; }
-
-/* Summary Tables (functions, variables, etc)
- * - Each object is described by a single row of the table with
- * two cells. The left cell gives the object's type, and is
- * marked with 'code.summary-type'. The right cell gives the
- * object's name and a summary description.
- * - CSS styles for the table's header and group headers are
- * defined above, under 'Table Headers'
- */
-table.summary { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin-bottom: 0.5em; }
-td.summary { border: 1px solid #608090; }
-code.summary-type { font-size: 85%; }
-table.summary a:link { color: #0000ff; }
-table.summary a:visited { color: #204080; }
-
-
-/* Details Tables (functions, variables, etc)
- * - Each object is described in its own div.
- * - A single-row summary table w/ table-header is used as
- * a header for each details section (CSS style for table-header
- * is defined above, under 'Table Headers').
- */
-table.details { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-table.details table { color: #000000; }
-table.details a:link { color: #0000ff; }
-table.details a:visited { color: #204080; }
-
-/* Fields */
-dl.fields { margin-left: 2em; margin-top: 1em;
- margin-bottom: 1em; }
-dl.fields dd ul { margin-left: 0em; padding-left: 0em; }
-dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; }
-div.fields { margin-left: 2em; }
-div.fields p { margin-bottom: 0.5em; }
-
-/* Index tables (identifier index, term index, etc)
- * - link-index is used for indices containing lists of links
- * (namely, the identifier index & term index).
- * - index-where is used in link indices for the text indicating
- * the container/source for each link.
- * - metadata-index is used for indices containing metadata
- * extracted from fields (namely, the bug index & todo index).
- */
-table.link-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090; }
-td.link-index { border-width: 0px; }
-table.link-index a:link { color: #0000ff; }
-table.link-index a:visited { color: #204080; }
-span.index-where { font-size: 70%; }
-table.metadata-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-td.metadata-index { border-width: 1px; border-style: solid; }
-table.metadata-index a:link { color: #0000ff; }
-table.metadata-index a:visited { color: #204080; }
-
-/* Function signatures
- * - sig* is used for the signature in the details section.
- * - .summary-sig* is used for the signature in the summary
- * table, and when listing property accessor functions.
- * */
-.sig-name { color: #006080; }
-.sig-arg { color: #008060; }
-.sig-default { color: #602000; }
-.summary-sig { font-family: monospace; }
-.summary-sig-name { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:link
- { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:visited
- { color: #006080; font-weight: bold; }
-.summary-sig-arg { color: #006040; }
-.summary-sig-default { color: #501800; }
-
-/* Subclass list
- */
-ul.subclass-list { display: inline; }
-ul.subclass-list li { display: inline; }
-
-/* To render variables, classes etc. like functions */
-table.summary .summary-name { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:link { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:visited { color: #006080; font-weight: bold;
- font-family: monospace; }
-
-/* Variable values
- * - In the 'variable details' sections, each varaible's value is
- * listed in a 'pre.variable' box. The width of this box is
- * restricted to 80 chars; if the value's repr is longer than
- * this it will be wrapped, using a backslash marked with
- * class 'variable-linewrap'. If the value's repr is longer
- * than 3 lines, the rest will be ellided; and an ellipsis
- * marker ('...' marked with 'variable-ellipsis') will be used.
- * - If the value is a string, its quote marks will be marked
- * with 'variable-quote'.
- * - If the variable is a regexp, it is syntax-highlighted using
- * the re* CSS classes.
- */
-pre.variable { padding: .5em; margin: 0;
- background: #dce4ec; color: #000000;
- border: 1px solid #708890; }
-.variable-linewrap { color: #604000; font-weight: bold; }
-.variable-ellipsis { color: #604000; font-weight: bold; }
-.variable-quote { color: #604000; font-weight: bold; }
-.variable-group { color: #008000; font-weight: bold; }
-.variable-op { color: #604000; font-weight: bold; }
-.variable-string { color: #006030; }
-.variable-unknown { color: #a00000; font-weight: bold; }
-.re { color: #000000; }
-.re-char { color: #006030; }
-.re-op { color: #600000; }
-.re-group { color: #003060; }
-.re-ref { color: #404040; }
-
-/* Base tree
- * - Used by class pages to display the base class hierarchy.
- */
-pre.base-tree { font-size: 80%; margin: 0; }
-
-/* Frames-based table of contents headers
- * - Consists of two frames: one for selecting modules; and
- * the other listing the contents of the selected module.
- * - h1.toc is used for each frame's heading
- * - h2.toc is used for subheadings within each frame.
- */
-h1.toc { text-align: center; font-size: 105%;
- margin: 0; font-weight: bold;
- padding: 0; }
-h2.toc { font-size: 100%; font-weight: bold;
- margin: 0.5em 0 0 -0.3em; }
-
-/* Syntax Highlighting for Source Code
- * - doctest examples are displayed in a 'pre.py-doctest' block.
- * If the example is in a details table entry, then it will use
- * the colors specified by the 'table pre.py-doctest' line.
- * - Source code listings are displayed in a 'pre.py-src' block.
- * Each line is marked with 'span.py-line' (used to draw a line
- * down the left margin, separating the code from the line
- * numbers). Line numbers are displayed with 'span.py-lineno'.
- * The expand/collapse block toggle button is displayed with
- * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not
- * modify the font size of the text.)
- * - If a source code page is opened with an anchor, then the
- * corresponding code block will be highlighted. The code
- * block's header is highlighted with 'py-highlight-hdr'; and
- * the code block's body is highlighted with 'py-highlight'.
- * - The remaining py-* classes are used to perform syntax
- * highlighting (py-string for string literals, py-name for names,
- * etc.)
- */
-pre.py-doctest { padding: .5em; margin: 1em;
- background: #e8f0f8; color: #000000;
- border: 1px solid #708890; }
-table pre.py-doctest { background: #dce4ec;
- color: #000000; }
-pre.py-src { border: 2px solid #000000;
- background: #f0f0f0; color: #000000; }
-.py-line { border-left: 2px solid #000000;
- margin-left: .2em; padding-left: .4em; }
-.py-lineno { font-style: italic; font-size: 90%;
- padding-left: .5em; }
-a.py-toggle { text-decoration: none; }
-div.py-highlight-hdr { border-top: 2px solid #000000;
- border-bottom: 2px solid #000000;
- background: #d8e8e8; }
-div.py-highlight { border-bottom: 2px solid #000000;
- background: #d0e0e0; }
-.py-prompt { color: #005050; font-weight: bold;}
-.py-more { color: #005050; font-weight: bold;}
-.py-string { color: #006030; }
-.py-comment { color: #003060; }
-.py-keyword { color: #600000; }
-.py-output { color: #404040; }
-.py-name { color: #000050; }
-.py-name:link { color: #000050 !important; }
-.py-name:visited { color: #000050 !important; }
-.py-number { color: #005000; }
-.py-defname { color: #000060; font-weight: bold; }
-.py-def-name { color: #000060; font-weight: bold; }
-.py-base-class { color: #000060; }
-.py-param { color: #000060; }
-.py-docstring { color: #006030; }
-.py-decorator { color: #804020; }
-/* Use this if you don't want links to names underlined: */
-/*a.py-name { text-decoration: none; }*/
-
-/* Graphs & Diagrams
- * - These CSS styles are used for graphs & diagrams generated using
- * Graphviz dot. 'img.graph-without-title' is used for bare
- * diagrams (to remove the border created by making the image
- * clickable).
- */
-img.graph-without-title { border: none; }
-img.graph-with-title { border: 1px solid #000000; }
-span.graph-title { font-weight: bold; }
-span.graph-caption { }
-
-/* General-purpose classes
- * - 'p.indent-wrapped-lines' defines a paragraph whose first line
- * is not indented, but whose subsequent lines are.
- * - The 'nomargin-top' class is used to remove the top margin (e.g.
- * from lists). The 'nomargin' class is used to remove both the
- * top and bottom margin (but not the left or right margin --
- * for lists, that would cause the bullets to disappear.)
- */
-p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em;
- margin: 0; }
-.nomargin-top { margin-top: 0; }
-.nomargin { margin-top: 0; margin-bottom: 0; }
-
-/* HTML Log */
-div.log-block { padding: 0; margin: .5em 0 .5em 0;
- background: #e8f0f8; color: #000000;
- border: 1px solid #000000; }
-div.log-error { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffb0b0; color: #000000;
- border: 1px solid #000000; }
-div.log-warning { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffffb0; color: #000000;
- border: 1px solid #000000; }
-div.log-info { padding: .1em .3em .1em .3em; margin: 4px;
- background: #b0ffb0; color: #000000;
- border: 1px solid #000000; }
-h2.log-hdr { background: #70b0ff; color: #000000;
- margin: 0; padding: 0em 0.5em 0em 0.5em;
- border-bottom: 1px solid #000000; font-size: 110%; }
-p.log { font-weight: bold; margin: .5em 0 .5em 0; }
-tr.opt-changed { color: #000000; font-weight: bold; }
-tr.opt-default { color: #606060; }
-pre.log { margin: 0; padding: 0; padding-left: 1em; }
diff --git a/docs/epydoc.js b/docs/epydoc.js
deleted file mode 100644
index e787dbc..0000000
--- a/docs/epydoc.js
+++ /dev/null
@@ -1,293 +0,0 @@
-function toggle_private() {
- // Search for any private/public links on this page. Store
- // their old text in "cmd," so we will know what action to
- // take; and change their text to the opposite action.
- var cmd = "?";
- var elts = document.getElementsByTagName("a");
- for(var i=0; i";
- s += " ";
- for (var i=0; i... ";
- elt.innerHTML = s;
- }
-}
-
-function toggle(id) {
- elt = document.getElementById(id+"-toggle");
- if (elt.innerHTML == "-")
- collapse(id);
- else
- expand(id);
- return false;
-}
-
-function highlight(id) {
- var elt = document.getElementById(id+"-def");
- if (elt) elt.className = "py-highlight-hdr";
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.className = "py-highlight";
- var elt = document.getElementById(id+"-collapsed");
- if (elt) elt.className = "py-highlight";
-}
-
-function num_lines(s) {
- var n = 1;
- var pos = s.indexOf("\n");
- while ( pos > 0) {
- n += 1;
- pos = s.indexOf("\n", pos+1);
- }
- return n;
-}
-
-// Collapse all blocks that mave more than `min_lines` lines.
-function collapse_all(min_lines) {
- var elts = document.getElementsByTagName("div");
- for (var i=0; i 0)
- if (elt.id.substring(split, elt.id.length) == "-expanded")
- if (num_lines(elt.innerHTML) > min_lines)
- collapse(elt.id.substring(0, split));
- }
-}
-
-function expandto(href) {
- var start = href.indexOf("#")+1;
- if (start != 0 && start != href.length) {
- if (href.substring(start, href.length) != "-") {
- collapse_all(4);
- pos = href.indexOf(".", start);
- while (pos != -1) {
- var id = href.substring(start, pos);
- expand(id);
- pos = href.indexOf(".", pos+1);
- }
- var id = href.substring(start, href.length);
- expand(id);
- highlight(id);
- }
- }
-}
-
-function kill_doclink(id) {
- var parent = document.getElementById(id);
- parent.removeChild(parent.childNodes.item(0));
-}
-function auto_kill_doclink(ev) {
- if (!ev) var ev = window.event;
- if (!this.contains(ev.toElement)) {
- var parent = document.getElementById(this.parentID);
- parent.removeChild(parent.childNodes.item(0));
- }
-}
-
-function doclink(id, name, targets_id) {
- var elt = document.getElementById(id);
-
- // If we already opened the box, then destroy it.
- // (This case should never occur, but leave it in just in case.)
- if (elt.childNodes.length > 1) {
- elt.removeChild(elt.childNodes.item(0));
- }
- else {
- // The outer box: relative + inline positioning.
- var box1 = document.createElement("div");
- box1.style.position = "relative";
- box1.style.display = "inline";
- box1.style.top = 0;
- box1.style.left = 0;
-
- // A shadow for fun
- var shadow = document.createElement("div");
- shadow.style.position = "absolute";
- shadow.style.left = "-1.3em";
- shadow.style.top = "-1.3em";
- shadow.style.background = "#404040";
-
- // The inner box: absolute positioning.
- var box2 = document.createElement("div");
- box2.style.position = "relative";
- box2.style.border = "1px solid #a0a0a0";
- box2.style.left = "-.2em";
- box2.style.top = "-.2em";
- box2.style.background = "white";
- box2.style.padding = ".3em .4em .3em .4em";
- box2.style.fontStyle = "normal";
- box2.onmouseout=auto_kill_doclink;
- box2.parentID = id;
-
- // Get the targets
- var targets_elt = document.getElementById(targets_id);
- var targets = targets_elt.getAttribute("targets");
- var links = "";
- target_list = targets.split(",");
- for (var i=0; i" +
- target[0] + "";
- }
-
- // Put it all together.
- elt.insertBefore(box1, elt.childNodes.item(0));
- //box1.appendChild(box2);
- box1.appendChild(shadow);
- shadow.appendChild(box2);
- box2.innerHTML =
- "Which "+name+" do you want to see documentation for?" +
- "
This document contains the API (Application Programming Interface)
-documentation for this project. Documentation for the Python
-objects defined by the project is divided into separate pages for each
-package, module, and class. The API documentation also includes two
-pages containing information about the project as a whole: a trees
-page, and an index page.
-
-
Object Documentation
-
-
Each Package Documentation page contains:
-
-
A description of the package.
-
A list of the modules and sub-packages contained by the
- package.
-
A summary of the classes defined by the package.
-
A summary of the functions defined by the package.
-
A summary of the variables defined by the package.
-
A detailed description of each function defined by the
- package.
-
A detailed description of each variable defined by the
- package.
-
-
-
Each Module Documentation page contains:
-
-
A description of the module.
-
A summary of the classes defined by the module.
-
A summary of the functions defined by the module.
-
A summary of the variables defined by the module.
-
A detailed description of each function defined by the
- module.
-
A detailed description of each variable defined by the
- module.
-
-
-
Each Class Documentation page contains:
-
-
A class inheritance diagram.
-
A list of known subclasses.
-
A description of the class.
-
A summary of the methods defined by the class.
-
A summary of the instance variables defined by the class.
-
A summary of the class (static) variables defined by the
- class.
-
A detailed description of each method defined by the
- class.
-
A detailed description of each instance variable defined by the
- class.
-
A detailed description of each class (static) variable defined
- by the class.
-
-
-
Project Documentation
-
-
The Trees page contains the module and class hierarchies:
-
-
The module hierarchy lists every package and module, with
- modules grouped into packages. At the top level, and within each
- package, modules and sub-packages are listed alphabetically.
-
The class hierarchy lists every class, grouped by base
- class. If a class has more than one base class, then it will be
- listed under each base class. At the top level, and under each base
- class, classes are listed alphabetically.
-
-
-
The Index page contains indices of terms and
- identifiers:
-
-
The term index lists every term indexed by any object's
- documentation. For each term, the index provides links to each
- place where the term is indexed.
-
The identifier index lists the (short) name of every package,
- module, class, method, function, variable, and parameter. For each
- identifier, the index provides a short description, and a link to
- its documentation.
-
-
-
The Table of Contents
-
-
The table of contents occupies the two frames on the left side of
-the window. The upper-left frame displays the project
-contents, and the lower-left frame displays the module
-contents:
-
-
-
-
- Project Contents...
-
- API Documentation Frame
-
-
-
-
- Module Contents ...
-
-
-
-
-
The project contents frame contains a list of all packages
-and modules that are defined by the project. Clicking on an entry
-will display its contents in the module contents frame. Clicking on a
-special entry, labeled "Everything," will display the contents of
-the entire project.
-
-
The module contents frame contains a list of every
-submodule, class, type, exception, function, and variable defined by a
-module or package. Clicking on an entry will display its
-documentation in the API documentation frame. Clicking on the name of
-the module, at the top of the frame, will display the documentation
-for the module itself.
-
-
The "frames" and "no frames" buttons below the top
-navigation bar can be used to control whether the table of contents is
-displayed or not.
-
-
The Navigation Bar
-
-
A navigation bar is located at the top and bottom of every page.
-It indicates what type of page you are currently viewing, and allows
-you to go to related pages. The following table describes the labels
-on the navigation bar. Note that not some labels (such as
-[Parent]) are not displayed on all pages.
-
-
-
-
Label
-
Highlighted when...
-
Links to...
-
-
[Parent]
-
(never highlighted)
-
the parent of the current package
-
[Package]
-
viewing a package
-
the package containing the current object
-
-
[Module]
-
viewing a module
-
the module containing the current object
-
-
[Class]
-
viewing a class
-
the class containing the current object
-
[Trees]
-
viewing the trees page
-
the trees page
-
[Index]
-
viewing the index page
-
the index page
-
[Help]
-
viewing the help page
-
the help page
-
-
-
The "show private" and "hide private" buttons below
-the top navigation bar can be used to control whether documentation
-for private objects is displayed. Private objects are usually defined
-as objects whose (short) names begin with a single underscore, but do
-not end with an underscore. For example, "_x",
-"__pprint", and "epydoc.epytext._tokenize"
-are private objects; but "re.sub",
-"__init__", and "type_" are not. However,
-if a module defines the "__all__" variable, then its
-contents are used to decide which objects are private.
-
-
A timestamp below the bottom navigation bar indicates when each
-page was last updated.
52"""
- 53 parse the HostList and replace any command as necessary
- 54 """
- 55#precompiled regexPattern which finds replacements in service strings
- 56pattern=re.compile("@(\w+)")
- 57#get a List of Host Objects and leave services unparsed for this moment
- 58parsedHosts=[Host(name,**values)forname,valuesinhosts.items()]
- 59#predefined dict to cache service replacements by name
- 60serviceReplacements={}
- 61forhostinparsedHosts:
- 62#list to store HostService Objects
- 63hostServices=[]
- 64#lets start to parse the Service Dict.
- 65forservicename,serviceParamsinhost.services.items():
- 66#bool to check if the service is defined.
- 67found=False
- 68#to a real iteration. just pick the right service
- 69forserviceinservices:
- 70ifservice.name!=servicename:
- 71continue
- 72#indicate we found a service
- 73found=True
- 74#check to see if we already regexed our service command
- 75ifservice.namenotinserviceReplacements:
- 76serviceReplacements[service.name]=pattern.findall(service.command)
- 77forparamsinserviceParams:
- 78#copy replacements from service command
- 79replacements=serviceReplacements[service.name][:]
- 80#for every Host.service.parameter we need a new HostService Object
- 81hostService=HostService(service.clone())
- 82#check if the ServiceParameter contain warnings or critical values
- 83if'warning'inparams:
- 84hostService.warning=params['warning']
- 85delparams['warning']
- 86if'critical'inparams:
- 87hostService.critical=params['critical']
- 88delparams['critical']
- 89#any remainig parm should be a replacement
- 90forparminparams:
- 91ifparmnotinreplacements:
- 92log.w("undefined parameter: "+parm+" in host "+host.name+" from service "+service.name)
- 93continue
- 94#replace our ServiceCommand with the parameter_value (search, replacement, string)
- 95hostService.setCommand(re.sub('@'+parm,params[parm],hostService.getCommand()))
- 96replacements.remove(parm)
- 97#host will not be inside ServiceParameters, so check this also
- 98if'host'inreplacements:
- 99log.d("replacing host in "+hostService.getCommand())
-100comm=re.sub('@host',host.host,hostService.getCommand())
-101hostService.setCommand(comm)
-102log.d("new Command: "+comm)
-103log.d("set in hostService: "+str(hostService))
-104replacements.remove('host')
-105#replacements should be empty now.
-106#If not we cannot use this command as some values are missing
-107iflen(replacements)>0:
-108log.w("Hostservice "+servicename+" from host "+host.name+" is ignored because of missing replacements: "+str(
-109replacements))
-110else:
-111#anything ok! add to our valid hostServices
-112hostServices.append(hostService)
-113#we could't find the service defined in this host. Service ignored!
-114ifnotfound:
-115log.w("Service "+servicename+" not defined in host "+host.name)
-116#replace host.service member by parsed HostService Objects
-117host.services=hostServices
-118returnparsedHosts
-
42parsedMembers=[Member(nameid,**values)fornameid,valuesinmembers.items()]
-43formemberinparsedMembers:
-44mFilter=[]
-45forfiltername,replacementinmember.filters.items():
-46found=False
-47forfiltinfilters:
-48iffilt.name!=filtername:
-49continue
-50found=True
-51memberFilter=filt.clone()
-52memberFilter.command=re.sub('@member',replacement,filt.command)
-53mFilter.append(memberFilter)
-54ifnotfound:
-55log.w("filter: "+filtername+" is not defined in member "+member.name)
-56member.filters=mFilter
-57returnparsedMembers
-
62"""
- 63 reads the config File and returns a dictionary, while lowering the first keys
- 64
- 65 :param configFilename: the path under which the configuration file should be found
- 66 """
- 67ifnotisfile(configFilename):
- 68msg="config file not found at "+str(configFilename)
- 69raiseConfigurationException(msg,self.log)
- 70
- 71self.configFilename=configFilename
- 72
- 73withopen(configFilename)ascfgFile:
- 74config=cfgFile.read()
- 75
- 76self.log.i("reading Config: "+configFilename)
- 77returnjson.loads(config)
-
80"""
- 81 creates an Main object from the configuration, but just parses raw data and hands it to the object
- 82
- 83 :param jsonDict: the configuration file part as dict
- 84 :param msgName: name of object for error message
- 85 :param creator: function pointer which is taking two arguments: identifier of the object and arguments.
- 86 :should return an object
- 87 :return: a list of objects returned by creator
- 88 """
- 89items=[]
- 90forkey,valinjsonDict.items():
- 91try:
- 92item=creator(key,val)
- 93items.append(item)
- 94exceptException:
- 95self.log.w("ignoring "+msgName+": "+key+"! reason:")
- 96self.log.w(str(Exception))
- 97returnitems
-
100"""
-101 imports and caches a module.
-102
-103 :param clazz: the filename of the module (i.e email, ping...)
-104 :param modPart: the folder of the module. (i.e services, parsers...)
-105 :return: the imported/cached module, or throws an error if it couldn't find it
-106 """
-107mods=self._loadedMods[modPart]
-108ifclazzinmods:
-109returnmods["class"]
-110else:
-111mod=__import__(clazz)
-112#path = join(getcwd(), "lib", modPart, clazz + ".py")
-113#self.log.w(path)
-114#mod = imp.load_source(clazz, path)
-115mods[clazz]=mod
-116returnmod
-
119"""
-120 replaces configuration dicts with their objects by importing and creating it in the first step.
-121 In the second step the original list of json config dicts gets replaced by the loaded objects
-122
-123 :param objList: the list of objects which is iterated on
-124 :param modPart: the folder from the module (i.e tasks, parsers)
-125 :param items_func: function to get a pointer on the list of json-config-objects to replace. Takes one argument and
-126 :param class_check: currently unsupported
-127 """
-128forobjinobjList:
-129repl=[]
-130items=items_func(obj)
-131forclazzIteminitems:
-132try:
-133if"class"notinclazzItem:
-134self.log.w("python says class is not in class item!")
-135self.log.w(modPart)
-136self.log.w(clazzItem)
-137self.log.w(clazzItem["class"])
-138
-139clazz=clazzItem["class"]
-140path="lib/"+modPart
-141sys.path.append(path)
-142mod=self._load_module(clazz,modPart)
-143item=mod.create(clazzItem)
-144repl.append(item)
-145#TODO: activate the crappy classcheck if answer is provided
-146#http://stackoverflow.com/questions/17179440/
-147self.log.d("warning: instance_check isn't working yet! TRUST_ALL = TRUE")
-148#if class_check(item):
-149# repl.append(item)
-150#else:
-151# self.log.w(" ignoring class " + clazzItem["class"] + "! It does not pass the class check!")
-152exceptImportError,err:
-153self.log.w("could not import "+clazz+": "+str(clazzItem)+"! reason")
-154self.log.w(str(err))
-155exceptKeyError,k:
-156self.log.w("Key "+str(k)+" not in classItem "+str(clazzItem))
-157exceptException,e:
-158self.log.w("Error while replacing class ( "+clazz+" ):"+str(e))
-159finally:
-160ifpathinsys.path:
-161delsys.path[sys.path.index(path)]
-162delitems[:]
-163items.extend(repl)
-
166"""
-167 replaces objects from the config by ids.
-168
-169 :param objectList: the list of objects to be iterated on
-170 :param replObjectList: the list of objects to replace
-171 :param id_list_func: function taking one argument as object and should return a list of config ids to replace
-172 :param id_get_func: function taking one config-object as argument and should return the config id to compare
-173 """
-174forobjinobjectList:
-175replacements=[]
-176idList=id_list_func(obj)
-177foridinidList:
-178repl=[oforoinreplObjectListifid==id_get_func(o)]
-179iflen(repl)==1:
-180replacements.append(repl[0])
-181
-182delidList[:]
-183idList.extend(replacements)
-
_create_raw_Object(self,
- jsonDict,
- msgName,
- creator)
- creates an Main object from the configuration, but just parses raw
- data and hands it to the object
replace_with_import(self,
- objList,
- modPart,
- items_func,
- class_check)
- replaces configuration dicts with their objects by importing and
- creating it in the first step.
creates an Main object from the configuration, but just parses raw
- data and hands it to the object
-
:param jsonDict: the configuration file part as dict :param msgName:
- name of object for error message :param creator: function pointer which
- is taking two arguments: identifier of the object and arguments. :should
- return an object :return: a list of objects returned by creator
:param clazz: the filename of the module (i.e email, ping...) :param
- modPart: the folder of the module. (i.e services, parsers...) :return:
- the imported/cached module, or throws an error if it couldn't find it
replaces configuration dicts with their objects by importing and
- creating it in the first step. In the second step the original list of
- json config dicts gets replaced by the loaded objects
-
:param objList: the list of objects which is iterated on :param
- modPart: the folder from the module (i.e tasks, parsers) :param
- items_func: function to get a pointer on the list of json-config-objects
- to replace. Takes one argument and :param class_check: currently
- unsupported
:param objectList: the list of objects to be iterated on :param
- replObjectList: the list of objects to replace :param id_list_func:
- function taking one argument as object and should return a list of config
- ids to replace :param id_get_func: function taking one config-object as
- argument and should return the config id to compare
parse_config(self,
- configFilename)
- parses the json configuration and returns a list of layouts,
-which contains all necessary information of the config file.
-
-parses the json configuration and returns a list of layouts,
-which contains all necessary information of the config file.
-parses the full config
-Parsing will be done in 3 steps:
-1. get raw Config Objects by just passing the values defined inside the config
-2. replace references by objects, import services, tasks, parsers and processors
-3. do sanity checks
-
-:param configFilename: the configuration file to parse
-
-
14super(IntervalPeriod,self).__init__(name)
-15
-16self.days=days# number of days to wait
-17self.weeks=weeks# number of weeks to wait
-18self.hours=hours# number of hours to wait
-19self.minutes=minutes# number of minutes to wait
-20self.seconds=seconds# number of seconds to wait
-21self.start_date=start_date# when to first execute
-22self.comment=comment# comment
-
36super(CronPeriod,self).__init__(name)
-37self.year=year# 4-digit year number
-38self.month=month# month number (1-12)
-39self.day=day# day of the month (1-31)
-40self.week=week# ISO week number (1-53)
-41self.day_of_week=day_of_week# number or name of weekday (0-6 or mon,tue,wed,thu,fri,sat,sun)
-42self.hour=hour# hour (0-23)
-43self.minute=minute# minute (0-59)
-44self.second=second# second (0-59)
-45self.start_date=start_date
-46self.comment=comment
-
91"""
- 92 Stop the daemon
- 93 """
- 94# Get the pid from the pidfile
- 95try:
- 96pf=file(self.pidfile,'r')
- 97pid=int(pf.read().strip())
- 98pf.close()
- 99exceptIOError:
-100pid=None
-101
-102ifnotpid:
-103message="pidfile %s does not exist. daemon not running?\n"
-104sys.stderr.write(message%self.pidfile)
-105return# not an error in a restart
-106
-107# Try killing the daemon process
-108try:
-109while1:
-110os.kill(pid,SIGTERM)
-111time.sleep(0.1)
-112exceptOSError,err:
-113err=str(err)
-114iferr.find("No such process")>0:
-115ifos.path.exists(self.pidfile):
-116os.remove(self.pidfile)
-117else:
-118printstr(err)
-119sys.exit(1)
-
129"""
-130 You should override this method when you subclass Daemon.
-131 It will be called after the process has been
-132 daemonized by start() or restart().
-133 """
-
daemonize(self)
- do the UNIX double-fork magic, see Stevens' "Advanced
- Programming in the UNIX Environment" for details (ISBN
- 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16
:param logLevel: the LoggingLevel from the console output (DEBUG
- default) :param logfile: the file where to log. Logs are rotated by
- default. :param logfileLevel: the LoggingLevel for the file Logger.
- (DEBUG default)
This is for checking the availability and output of HTTP services.
- Basic HTTP content could be fetched and compared.HTTPS is not validating
- the server certificate!
-
This should just return 0 on success and NOT 0 on error. Just to make
- internals generic to just report this code and not use a parser.
- 1"""
- 2The http service.
- 3
- 4This is for checking the availability and output of HTTP services. Basic HTTP
- 5content could be fetched and compared.HTTPS is not validating the server certificate!
- 6
- 7This should just return 0 on success and NOT 0 on error. Just to make internals generic
- 8to just report this code and not use a parser.
- 9"""
-10
-11importurllib
-12fromserviceimportService
-13
-14
-
- 1"""
- 2The ssh service This is for executing remote shell commands and retrieve the output.
- 3
- 4This service is using paramiko (http://www.lag.net/paramiko/).
- 5"""
- 6
- 7importparamiko
- 8importpprint
- 9importos
-10fromserviceimportService
-11
-12
-
- 1"""
- 2The tcpconnect service. This is to check if a service on a specific port is reachable.
- 3
- 4This should just return 0 on success and NOT 0 on error. Just to make internals generic to just report this code and
- 5not use a parser.
- 6"""
- 7
- 8importsocket
- 9fromlib.config.servicesimportService
-10fromserviceimportService
-11
-12
-
15#Service.__init__(self, **kwargs)
-16super(TcpconnectService,self).__init__(**kwargs)
-17
-18args=self.get_arguments()
-19if"port"inargs:
-20self.port=args["port"]
-21else:
-22raiseException("There is no port set")
-
10ifnot"type"inkwargs:
-11raiseException("'type' not in typeDict "+str(kwargs))
-12ifnot"args"inkwargs:
-13raiseException("typeDict "+str(kwargs)+" has nor arguments!")
-14self.set_task_type(kwargs["type"])
-15self.recipient=kwargs["args"]["rcpt"]
-
10ifnot"type"inkwargs:
-11raiseException("'type' not in typeDict "+str(kwargs))
-12ifnot"args"inkwargs:
-13raiseException("typeDict "+str(kwargs)+" has no arguments!")
-14self.set_task_type(kwargs["type"])
-15self.recipient=kwargs["args"]["rcpt"]
-
12"""
-13 sets the type of this task.
-14
-15 Be aware! this method can only get called once!
-16
-17 :param taskType: the type of this task
-18 """
-19ifhasattr(self,"_taskType"):
-20raiseException("taskType is only allowed to set once!")
-21self.taskType=taskType
-
30"""
-31 this is the method tasks usually override.
-32 It gets called anytime the task should get executed
-33
-34 default does nothing
-35
-36 :param msg: the msg for this task
-37 """
-38pass
-
41"""
-42 internal method which gets called for any member in a hostgroup.
-43 It determines if it has an appropriate type by comparing taskType with get_task_type().
-44 Calls execute_task() if the type matches
-45
-46 :param taskType: the type of the fail which is compared with get_task_type()
-47 :param msg: the error message
-48
-49 :return: True if execute_task() is called succesfully, else False
-50 """
-51ifself.get_task_type()==taskType:
-52self.execute_task(msg)
-53returnTrue
-54returnFalse
-
internal method which gets called for any member in a hostgroup. It
- determines if it has an appropriate type by comparing taskType with
- get_task_type(). Calls execute_task() if the type matches
-
:param taskType: the type of the fail which is compared with
- get_task_type() :param msg: the error message
-
:return: True if execute_task() is called succesfully, else False
10ifnot"type"inkwargs:
-11raiseException("'type' not in typeDict "+str(kwargs))
-12ifnot"args"inkwargs:
-13raiseException("typeDict "+str(kwargs)+" has nor arguments!")
-14self.set_task_type(kwargs["type"])
-15self.recipient=kwargs["args"]["rcpt"]
-
When javascript is enabled, this page will redirect URLs of
-the form redirect.html#dotted.name to the
-documentation for the object with the given fully-qualified
-dotted name.