Commit 48d9a1c7 authored by Łukasz Nowak's avatar Łukasz Nowak

Make GenericSlapRecipe subclass of GenericBaseRecipe.

Thanks to this all goodies provided by GenericBaseRecipe are available to
"connected" recipes.
parent 87fb9799
...@@ -24,24 +24,20 @@ ...@@ -24,24 +24,20 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import logging
from slapos import slap from slapos import slap
import zc.buildout
import zc.recipe.egg
import time import time
import re import re
import urlparse import urlparse
class GenericSlapRecipe(object): from generic import GenericBaseRecipe
class GenericSlapRecipe(GenericBaseRecipe):
"""Base class for all slap.recipe.*""" """Base class for all slap.recipe.*"""
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
"""Default initialisation""" """Default initialisation"""
self.name = name
options['eggs'] = 'slapos.cookbook' options['eggs'] = 'slapos.cookbook'
self.options = options GenericBaseRecipe.__init__(self, buildout, name, options)
self.buildout = buildout
self.logger = logging.getLogger(self.name)
self.slap = slap.slap() self.slap = slap.slap()
# SLAP related information # SLAP related information
...@@ -53,12 +49,6 @@ class GenericSlapRecipe(object): ...@@ -53,12 +49,6 @@ class GenericSlapRecipe(object):
self.key_file = slap_connection.get('key-file') self.key_file = slap_connection.get('key-file')
self.cert_file = slap_connection.get('cert-file') self.cert_file = slap_connection.get('cert-file')
# setup egg to give possibility to generate scripts
self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
# Hook options
self._options(options)
# setup auto uninstall/install # setup auto uninstall/install
self._setupAutoInstallUninstall() self._setupAutoInstallUninstall()
...@@ -89,10 +79,6 @@ class GenericSlapRecipe(object): ...@@ -89,10 +79,6 @@ class GenericSlapRecipe(object):
"""Hook which shall be implemented in children class""" """Hook which shall be implemented in children class"""
raise NotImplementedError('Shall be implemented by subclass') raise NotImplementedError('Shall be implemented by subclass')
def _options(self, options):
"""Hook which can be implemented in children class"""
pass
def setConnectionUrl(self, *args, **kwargs): def setConnectionUrl(self, *args, **kwargs):
url = self._unparseUrl(*args, **kwargs) url = self._unparseUrl(*args, **kwargs)
self.setConnectionDict(dict(url=url)) self.setConnectionDict(dict(url=url))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment