Module author: Davide Alberani
Bases: endian.job.job.Job
Base class for jobs that need to manage the apache configuration.
Update symlink in Apache’s configuration directories.
Write a /var/efw/{section}/httpd_ports csv file with the format ip_address,port
Module author: Alber Maximilian
Bases: endian.job.job.Job
A job to crawl in the file system and perform actions on the files.
You should overwrite:
You may set:
You may overwrite:
Should be overwritten.
Hook to perform a operation on the crawled file.
Parameters: | file (Strings) – The filename. |
---|---|
Returns: | The filename of the, may changed file or None. |
Return type: | String |
Should be overwritten.
Returns the search pattern.
In the default implemenation the function looks, if a the settings_file_name and a pattern_key is defined and reads out of the settings file the pattern. If not it uses the member pattern. If even this not exists an empty string will be returned.
Returns: | The search patterns. |
---|---|
Return type: | list of strings String or String |
May returns the settings file used by this job, otherwise an empty string.
As default implementation this function return the class member settings_file_name.
Returns: | May the settings file used by this job or an empty string. |
---|---|
Return type: | String |
Loads the settings file named by the function get_settings_file_name into the member config_values.
Should be overwritten.
Post hook, is triggered after the crawling.
Parameters: | files (list of Strings) – The list of found files. |
---|---|
Returns: | The return value of the start function. |
Return type: | Not specified |
Should be overwritten.
Prepartion hook, is triggered before the crawling.
Parameters: | files (list of Strings) – The list of found files. |
---|---|
Returns: | The list of found files. |
Return type: | list of Strings |
Starts the job. :param options: A dict with options. :type options: dict
Starts the job. :param options: A dict with options. :type options: dict
Takes the pattern to search for files. The founded filenames are filtered by pre. Then for each filename crawl will performed. In the end post will called with the filenames.
Parameters: | options (dict) – A dict with options. |
---|
Module author: Alber Maximilian
Bases: endian.job.generic.cronjob.GenericCronJob
A job to schedule cron scripts.
Following functions can/should be overwritten:
Following function may be overwritten:
Bases: endian.job.generic.cronjob.GenericCronJob
A job to schedule anacron scripts.
Following functions can/should be overwritten:
Following function may be overwritten:
Module author: Alber Maximilian
Bases: endian.job.job.Job
A generic job to schedule file downloads and trigger pre and post actions.
You can or overwrite the hook function or use their default implementations and set members.
Following functions can/should be overwritten: * should_update * get_urls * pre * post_un_compress * post
Following function may be overwritten:
You may set one of this members:
Returns the tmp directory to use.
Returns: | The directory name. |
---|---|
Return type: | String |
If the directory was created by the job, the function will delete it.
Parameters: | tmp_dir (String) – The tmp directory. |
---|
Downloads the urls and stores them in the tmp directory. Returns the urls parameter with a mapping between urls and tmp files(key tmp_file). If a settings file is specified, the etag_key is set in the urls dict and the url has a etag, it will be saved.
Parameters: |
|
---|---|
Returns: | The urls parameter, each dict extened with the key tmp_file |
Return type: | list of dicts |
May be overwritten.
Returns a tuple with username and password for a eventually http authentication. If no authentication is necessary it will return None.
The default implementation will look, if in the options is httpusername and httppassword setted, the the those are returned, otherwise the function will lookup self.config_values for a credentials entry. If this is set to ‘off’ None will returned, otherwise the functions will look in ‘{entry}/settings’ for ‘httpusername’ and ‘httppassword’ and return those.
Returns: | A username and password tuple or None. |
---|---|
Return type: | A string tuple or None |
May returns the settings file used by this job, otherwise an empty string.
As default implementation this function return the class member settings_file_name.
Returns: | May the settings file used by this job or an empty string. |
---|---|
Return type: | String |
Should be overwritten.
Returns dicts with information about the urls to download.
The dict will have following keys:
The dict will mey have following keys:
etag: the etag of the last download.
file which should be uncompressed.
to save.
archive.
In the default implementation the function will use, if exists, the member urls to create the dicts. If url_key, etag_key, uncompress_key, location_key or archive_prefix_key is given in the dict, the function will lookup in the settings file for the value. If the key is not given or the value is empty, the value referenced by the key url, etag, uncompress, location or archive_prefix will used. If both keys are missing no entry will made in the return dict. For the etag you can also a specify a different settings file using the key etag_file.
Returns: | A list of url dicts. |
---|---|
Return type: | list of dicts |
Loads the settings file named by the function get_settings_file_name into the member config_values.
Should be overwritten.
Post hook, is triggered after the download and the possible uncompressing.
In the default implementation the content of urls with a location key in the urls parameter will be moved to this location.
Parameters: |
|
---|
Should be overwritten.
Post hook to eventually uncompress the files, is triggered after the download and before the post hoook.
In the default implementation the urls with uncompress as key in the urls parameter will be uncompressed and the key download_location will be added to the urls dict.
Parameters: |
|
---|---|
Returns: | The url list to pass to the post hook. |
Return type: | list of dicts |
Should be overwritten.
Prepartion hook, is triggered before the download.
Parameters: |
|
---|---|
Returns: | The url list to pass to the download. |
Return type: | list of dicts |
Starts the job.
Parameters: | options (dict) – A dict with options. |
---|
Set the timestamp after a successful download.
Should be overwritten.
Returns True, if there is new content to download.
In the default implementation the function will return true, if no etag key is in the url dict otherwise will controll, if the etag has changed.
Parameters: | urls (list of dicts) – The urls to download. |
---|---|
Returns: | The urls to update. |
Return type: | list of dicts |
Starts the download jobs. In detail controlls, if there is new data. If so, launches the pre hook, downloads the urls retrieved by getURLS, lanaunches the postUnCompress and then the post hook.
Parameters: | options (dict) – A dict with options. |
---|
Bases: endian.job.job.Job
Expand environ variables of form $var and ${var}. Unknown variables are left unchanged.
Check if the filename is a valid filename for run-parts Valid filenames should consist entirely of upper and lower case letters, digits, underscores (‘_’), and hyphens (‘-‘).
Parameters: | filename (string) – filename |
---|---|
Returns: | True if the filename is a run-parts valid filename, False otherwise |
Return type: | bool |
Parse a jobsengine filename (parse the filename, not the content), in the format: [PRIORITY].cmd.args where PRIORITY is a number, cmd is a cmd in ‘start’, ‘stop’, ‘restart’, ‘emit’, ‘call’, and ‘request’ args are the mandatory cmd arguments
If the file is not empty, the file content is used as additional argument. Env variables of form $var and ${var} in the file content are expanded, e.g. options(home:”${HOME}”) –> options(home:”/Users/andreax”)
Example of valid filename:
05.restart.xyz 05restart.xyz # missing ‘.’ after priority, but accepted 05.restart.sync.xyz restart.xyz restart.sync.xyz
Parameters: |
|
---|---|
Returns: | a cmd to send to the jobsengine (e.g. ‘start ssh’) or None |
Return type: | string |
Runs a number of scripts and jobsengine commands found in a single directory directory. Scripts and jobsengine commands are recognized by the filename.
digits, underscores, and hyphens (e.g. 01interfacemark)
If the file is not empty, the file content is used as additional argument.
Parameters: |
|
---|
Module author: Peter Warasin
Bases: endian.job.job.Job