Example #1
0
class StandardHosting(abstract_buildout.AbstractBuildout):
    _template_dir = "templates/plone_hosting"
    use_cheetah = True
    summary = "Plone hosting: buildout with ZEO and Plone versions below 3.2"
    required_templates = []
    help = """
This template helps you to create an entire zope hosting setup, including
ZEO and a single Zope client instance.  If you desire, it can also install
and set up the Varnish Caching/Proxy Server.    

Please Note:
Due to changes in the packaging of Plone, this template is not suitable
for versions of Plone beyond 3.1.7.  If you are trying to use a later 
version of plone, you will need to edit the buildout resulting from this
template in order to have it work correctly.  Information related to these
issues may be found here:

http://plone.org/documentation/kb/repair-a-plone-3.1-buildout

and here:

http://plone.org/products/zopeskel/issues/25
"""

    vars = copy.deepcopy(abstract_buildout.AbstractBuildout.vars)
    vars = [
        abstract_buildout.VAR_ZOPE_USER,
        abstract_buildout.VAR_ZOPE_PASSWD,
        IntVar(
            "base_port",
            title="Base Port #",
            description="# to use as base for Zope/ZEO/proxy ports",
            modes=(EASY, EXPERT),
            page="Main",
            default=8000,
            help="""
For standardization, rather than selecting ports for Zope, ZEO, and
a proxy individually, these are tied together numerically.

ZEO port = Base + 0 | Proxy port = Base + 1 | HTTP port = Base + 10

If the ports specified by any of these numbers are already in use or
otherwise unavailable, this template will inform you of the problem and
exit with an error.  If this happens, please try another number for
'Base Port #'
""",
        ),
        BooleanVar(
            "proxy",
            title="Install proxy server?",
            description="Should a proxy server be installed?",
            default=False,
            help=""" 
If you ask for a proxy server to be installed, this template will include
the Varnish Caching/Proxy server.  If you wish to use a different proxy
server, please answer False and install your own.  
""",
        ),
        StringVar(
            "plone",
            title="Plone Version",
            description="Version to install (2.5, 2.5.1, 3.0, 3.0.1, etc)",
            default="3.1.7",
            help="""
You can use this template to install any version of Plone from 2.5 on. 
Versions of Plone more recent than 3.1.7 will require some editing of the
generated configuration files.  Please see the long description of this
template (run 'zopskel --list') for more details.  In general it is 
advisable to use the most recent version of Plone.  You can find a list of 
stable Plone releases at 

http://plone.org/products/plone/releases/

""",
        ),
        BooleanVar(
            "buildout",
            title="Run Buildout?",
            description="Should bin/buildout command be executed?",
            default=True,
            help="""
Would you like this template to automatically run the buildut command as soon
as it finishes creating the required files?  Please note that if you've chosen
to build a version of Plone more recent than 3.1.7 running buildout will fail
unless you make changes to the generated configuration files.  Please see the
long description of this package (run 'zopeskel --list') for more details.

If you intend on adding any specific third-party products or modifying the
buildout in any way, you should answer 'False'.  Then make your modifications
and run `python bootstrap.py` followed by `bin/buildout`.
""",
        ),
    ]

    def _buildout(self, output_dir):
        olddir = os.getcwd()
        try:
            os.chdir(output_dir)
            print "Bootstrapping the buildout"
            subprocess.call([sys.executable, "bootstrap.py"])
            print "Configuring the buildout"
            subprocess.call(["bin/buildout", "-n"])
        finally:
            os.chdir(olddir)

    def _checkPortAvailable(self, port):
        s = socket.socket()
        try:
            s.connect(("127.0.0.1", port))
        except socket.error, e:
            s.close()

            if e.args[0] == errno.ECONNREFUSED:
                return

            raise BadCommand("Error checking port availability: %s" %
                             e.args[1])

        s.close()
        raise BadCommand("Port %s is already in use" % port)
Example #2
0
 def setUp(self):
     self.ivar = IntVar('name', 'description')