How to install slapos.librecipe
- Download and install ActivePython
- Open Command Prompt
- Type
pypm install slapos.librecipe
Lastest release
Egg, which contains all needed requirements, libraries and parent classes for easy slap.recipe.* creation.
How to use?
In setup.py of recipe add only one install requires to slap.librecipe.
In code itself subclass from slap.librecipe.BaseSlapRecipe.BaseSlapRecipe.
Use _install hook:
from slap.librecipe.BaseSlapRecipe import BaseSlapRecipe
- class Recipe(BaseSlapRecipe):
... def _install(self):
# refer below for list of available objects specific code of recipe
Available variables self.:
- name and options passed by zc.buildout during init
- work_directory -- buildout's directory
- bin_directory -- places for generated binaries
- running_wrapper_location -- filename of wrapper to create
- data_root_directory -- directory container for data -- inside this directory it is advised to create named directories for provided servers which needs data
- var_directory -- container for various, unix following things: * log_directory -- container for logs * run_directory -- container for pidfiles and sockets
- etc_directory -- place to put named files and directories of configuration for provided servers
- computer_id -- id of computer
- computer_partition_id -- if of computer partition
- server_url - url of Vifib server
- software_release_url -- url of software release being instantiated
- slap -- initialised connection to Vifib server
- computer_partition -- initialised connection to computer partition
- request -- shortcut to computer partition request method
By default all directories are created before calling _install hook.
In case if subclass would like to change the structure of directories _createDefaultDirectoryStructure method shall be overloaded.
- Available helper methods:
- _writeFile
- _createDirectory
- _createRunningWrapper Before calling self.wrapper_template_location shall be set (eg. by pkg_resources.resource_filename)
_install method shall return list of paths which are safe to be removed by buildout during part uninstallation.