예제 #1
0
def template(name=None, url=None):
    """
    Require an OpenVZ OS template.

    If the OS template is not installed yet, it will be downloaded from
    *url* using :py:func:`~fabtools.openvz.download_template()`::

        from fabtools import require

        # Use custom OS template
        require.openvz.template(url='http://example.com/templates/mybox.tar.gz')

    If no *url* is provided, :py:func:`~fabtools.openvz.download_template()`
    will attempt to download the OS template from the
    `download.openvz.org <http://download.openvz.org/template/precreated/>`_
    repository::

        from fabtools import require

        # Use OS template from http://download.openvz.org/template/precreated/
        require.openvz.template('debian-6.0-x86_64')

    """
    if name is not None:
        filename = '%s.tar.gz' % name
    else:
        filename = os.path.basename(url)

    if not is_file(os.path.join('/var/lib/vz/template/cache', filename)):
        openvz.download_template(name, url)
예제 #2
0
파일: openvz.py 프로젝트: hagai26/fabtools
def template(name=None, url=None):
    """
    Require an OpenVZ OS template.

    If the OS template is not installed yet, it will be downloaded from
    *url* using :py:func:`~fabtools.openvz.download_template()`::

        from fabtools import require

        # Use custom OS template
        require.openvz.template(url='http://example.com/templates/mybox.tar.gz')

    If no *url* is provided, :py:func:`~fabtools.openvz.download_template()`
    will attempt to download the OS template from the
    `download.openvz.org <http://download.openvz.org/template/precreated/>`_
    repository::

        from fabtools import require

        # Use OS template from http://download.openvz.org/template/precreated/
        require.openvz.template('debian-6.0-x86_64')

    """
    if name is not None:
        filename = "%s.tar.gz" % name
    else:
        filename = os.path.basename(url)

    if not is_file(os.path.join("/var/lib/vz/template/cache", filename)):
        openvz.download_template(name, url)
예제 #3
0
파일: openvz.py 프로젝트: LucsT/fabtools
def template(name=None, url=None):
    """
    Require an OpenVZ template
    """
    if name is not None:
        filename = '%s.tar.gz' % name
    else:
        filename = os.path.basename(url)

    if not is_file(os.path.join('/var/lib/vz/template/cache', filename)):
        openvz.download_template(name, url)